ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > Class(2017-2018-1)ZSTU > student homework directory > >
Homework5 Version 0
👤 Author: by 1431129356qqcom 2017-11-09 13:15:30
There are at least three variations of the readers-writers problems.
1.The first readers-writers problem, in which the constraint is added that no reader shall be kept waiting if the share is currently opened for reading.
A solution:
semaphore resource=1;
semaphore rmutex=1;
readcount=0;

writer() {
resource.P();//Lock the shared file for a writer

<CRITICAL Section>
// Writing is done

<EXIT Section>
resource.V();//Re

Please login to reply. Login

Reversion History

Loading...
No reversions found.