The program as shown below:
REPEAT REPEAT
Start close
Normal operation
Stop and open the door
UNTIL FALSE UNTIL FALSE
semaphore s1,s2;
s1=0; //door
s2=0; //Car
P1() //driver
{
wait(s1);
start up
Normal driving
Arrival
signal(s2);
}
P2()//The conductor
{
close the door;
signal(s1);
Ticket sales
wait(s2);
Open the door;
}