Multiple-Person Bumper Car Ride: Rendezvous

Modify your multiple-person bumper car program so that the coordinator class no longer uses semaphores but uses the rendezvous concept instead. Eliminate the restriction that at most two cars can be on the bumping floor at any one time, that is, as many cars as are full of riders and ready to bump can enter the floor.

Your coordinator class will have the interface routines

getInLine(ID)
waitCarFull(ID)
takeAride(ID)
load(ID)
unload(ID)
called by the riders and cars.

The bumper car is a separate class that is created multiple times. Ditto the rider class.

The coordinator object will create an EstablishRendezvous object (local case) that the rider and car threads will call indirectly through the coordinator interface methods mentioned above. When a rider calls getInLine(), the coordinator will call the EstablishRendezvous method clientToServer(), which returns an ExtendedRendezvous object. When a rider calls waitCarFull(), the coordinator will call the ExtendedRendezvous method clientMakeRequestAwaitReply(). When a rider calls takeAride(), the coordinator will again call the ExtendedRendezvous method clientMakeRequestAwaitReply().

When a car thread calls load(), the coordinator will call the serverToClient() method of the EstablishRendezvous object, which will return an ExtendedRendezvous object, as many times as the car has room for riders. Each of these ExtendedRendezvous objects will be ``connected'' to a rider thread. Think carefully about whether or not multiple cars should be allowed to load at the same time. When the car is full, each ExtendedRendezvous object will have its serverGetRequest() and serverMakeReply() methods called. When the car's ride is over, each ExtendedRendezvous object will have its serverGetRequest() and serverMakeReply() methods called again. This will complete two rendezvous with the rider threads: waitCarFull() and takeAride().

No semaphores and no busy waiting allowed! Only three nap()'s are allowed in this program: riders wandering, cars bumping, and one in main() to shutdown the simulation.