ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > classbefore2015 >
6.11 2013329600158 ShengCheng Version 0
👤 Author: by 454931759qqcom 2015-10-29 12:05:13
semaphore mutex,waiting,baber_sleep;
boolean new_customer;             //whether there is a new customer or not
int num_customer;                     //number of customer

boolean run(void){
if (num_customer>0){return true;} //still has customer
else return false;
}

do{
do{
wait(mutex);
if(new_customer){ //comes a new customer
num_customer++;
if(num_customer>n) //leave
num_customer–;
if(num_customer>1&&num_customer<=n) //wait
signal(waiting

Please login to reply. Login

Reversion History

Loading...
No reversions found.