Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How many threads/processes are there? What does each thread/process simulate? Wi

ID: 3566075 • Letter: H

Question

How many threads/processes are there? What does each thread/process simulate? Will each thread/process be blocked at some time of simulation? If yes, explain the circumstances. When will a blocked thread/process be waked up, and by whom? How many semaphores are there in this program, what is the purpose for having each? Write program to simulate the following IPC problem. Make sure to use mutex locks or semaphores to synchronize the processes/threads. Display messages to the screen to show the state of the system. A good way to validate your program is running correctly is to perform some simple output messages to show the state of the system. You can experiment with these messages, but in general you want to demonstrate what each thread is doing. You can use an integer number to identify each thread. Jurassic Park Jurassic Park consists of a dinosaur museum and a park for safari tiding. There are n passengers and m single-passenger cars. Passengers wander around the museum for a while, then line up to take a ride in a safari car. When a car is available, it loads the one passenger it can hold and rides around the park for a random amount of time. If the m cars are all out riding passenger around, the passenger who wants to ride waits; if a car is ready to load but there are no waiting passengers, then the car waits. Use semaphores to synchronize the n passenger threads/processes and the m car threads/processes.

Explanation / Answer

emaphore CarAvailable = 0 Semaphore PassengerAvailable = 0 Passenger ( ) { Wander_Around ( ) ; up( PassengerAvailable ) ; down( CarAvailable ) ; Take_a_ride ( ) ; } Car ( ) { While (TRUE) { down( PassengerAvailable ) ; up( CarAvailable ) ; Give_ a_ride ( ) ; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote