Question: A roller coaster is able to serve C passengers at one ride. Passengers call embark() and disembark() functions to get on and off the roller

A roller coaster is able to serve C passengers at one ride. Passengers call embark() and disembark() functions to get on and off the roller coaster respectively. In addition, before any passenger gets on the roller coaster, the roller coaster should call new_ride() function. Similarly, before any passenger gets off the roller coaster, it should call end_of_ride() function. The roller coaster starts it ride only when at full capacity (C passengers).

Write the pseudocode for passenger and roller coaster entities and explain the mutex and synchronization mechanisms you use clearly.

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!