ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > 2017329621034 郭诚 >
Homework 4 Version 0
👤 Author: by 157128166qqcom 2019-11-19 07:19:39 last modified by 157128166qqcom
Problem: 

Suppose the driver's activity on the bus is to start the vehicle, drive normally, stop at the station;The conductor's activity is to close the door, sell tickets, open the door.

First, let semaphore S1 and S2:

S1 indicates whether the driver is allowed to start the car. The initial value is 0.

S2 indicates whether the conductor is allowed to open the door, with an initial value of 0.

driver(){

P(S1);

start the vehicle;

drive normally;

stop at the station;

V(S2);

}

conductor(){

close the door;

V(S1);

sell tickets;

P(S2)

open the door;

}

Please login to reply. Login

Reversion History

Loading...
No reversions found.