Question: This homework is about Process/Thread Synchronization. PLEASE label your answer a) and b) so I know which one is which. Also keep the code simple

This homework is about Process/Thread Synchronization. PLEASE label your answer a) and b) so I know which one is which. Also keep the code simple as you can. Thanks!!!
 This homework is about Process/Thread Synchronization. PLEASE label your answer a)
Here is the code used to do part a) and b)
and b) so I know which one is which. Also keep the

3. Consider simulating a roller coaster amusement ride with one car of capacity CAPACITY passengers. The passengers arrive, wait until the car is ready for boarding, then board (one by one). When the roller coaster car is full, it leaves for the ride. When it returns, the passengers leave the car (no leaving in the middle of the ride!). When all passengers have left the car, new passengers can start boarding a) Is it possible that a passenger enjoys the ride before the roller coaster car has left (that is prints the message before the ride starts)? If no, justify why. If yes, correct the code - you may need to introduce a new semaphore or so. (No need to fully rewrite the code here, you may write/insert into the code provided on the next page.) b) Assume there are VIPs who would also like to take a ride. However a VIP is so important and has bodyguards, so he/she will use 5 spaces instead of 1. Moreover, VIPs don't like to wait: if VIP boards, the roller coaster car should leave even if it is nowhere near full. If there are less then 5 spaces left, the VIP cannot fit and the roller coaster car must leave (without the VIP) so it returns sooner and the VIP does not wait unnecessarily. Your task: Write the code for the VIP. Make sure that even if there are plenty of waiting passengers and the VIP process boards the roller coaster car first (assume that the VIP process has the same scheduling priority as the other processes)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!