ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621261李翔岚 >
Homework5 Version 0
👤 Author: by 1079513613qqcom 2020-11-03 07:32:57
Use the record semaphore to solve the following problems, and write the process synchronization algorithm in C-like language.
Driver P1 Conductor P2
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;
}

Please login to reply. Login

Reversion History

Loading...
No reversions found.