[cs33211] Construction Zone

Mikhail Nesterenko mikhail at cs.kent.edu
Sat Oct 6 17:47:21 EDT 2012


> I don't understand the full idea of the 3 parts (entrance, crossing,
> exit) along with condition variables. Is there any hint I can get?
> 

Each function pedestrian(), carWest(), carEast() which is executed by
an appropriate thread, should have three parts:

     * zone entrance - determining whether the car can enter the
       	         construction zone (depending on whether pedestrians
       	         or other cars are already there) if not possible to
       	         enter - blocking. This code needs to use locks
       	         (mutexes) and condition variables to implement the
       	         ODOT zone crossing conditions.

     * zone crossing. Use sleep_for() to block the thread for
       	    	 the appropriate amount of time

     * zone exit - notifying threads blocked on zone entrance, other
       	    	 possible synchronization actions.


> I am getting confused regarding the part of allowing another car to
> go IF going in same direction.

If one car is crossing the construction zone and another car going in
the same direction appears, the second car is allowed to enter the
construction zone.

Thanks,
--
Mikhail


More information about the cs33211 mailing list