The Second Readerwriter problem requires that once a writer

The Second Reader-writer problem requires that, once a writer process is ready, it perform its write as soon as possible. That is, if a writer is waiting to access the object, no new readers can start reading.Write a semaphore-based solution for Second reader-writer problem.

Solution

The solutionn of reader-writer problem using semaphore is as follows:

Writer process Reader Process
wait(write);
. . .
writing is performed
. . .
signal(write);
wait(mutually exclusive);
readingcount := readingcount + 1;
if readingcount = 1 then wait(write);
signal(mutually exclusive);
. . .
reading is performed
. . .
wait(mutually exclusive);
readingcount := readingcount - 1;
if readcount = 0 then signal(write);
signal(mutually exclusive);
The Second Reader-writer problem requires that, once a writer process is ready, it perform its write as soon as possible. That is, if a writer is waiting to acc

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site