Traffic Control Problem
NS-cars.c
and EW-cars.c
are two programs that simulate traffic control. When north-south cars pass the crossroads, they should ensure that road from north to south is available, if north-south road is not available, they keep waiting. This is the same to east-west cars. Note that when north-south road is available, east-west road is not available and vice versa.
Please add semaphore synchronization in these two programs so that north-south cars and east-west cars can pass the crossroads alternately and there will not be car accident.
Last updated