ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621049_胡成一 >
homework5_胡成一_2018329621049 Version 0
👤 Author: by 450766287qqcom 2020-12-08 05:48:50
we have a book, and there many people want to borrow that book
and the book can only be took by one person.
the variable "available" means that the book is sent back and can be borrowed again.

// for each person that wants to borrow a book
while(true)
{
wait(available); // wait until the book is available
//critical section
signal(available); //give an available signal that the book can be borrow
//remainder section
}

Please login to reply. Login

Reversion History

Loading...
No reversions found.