consider the solution to the readers writers problem monitor

consider the solution to the readers writers problem.

monitor reders/writters {

int read_cnt = 0, writting = 0;

condition OK_to_read, OK_to_write;

start_read(){

if(writting || !empty(OK_to_write)) OK_to_read.wait;

OK_to_read.signal;

}

end read() {

read_cnt = read_cnt - 1;

if (read_cnt ==0) OK_to_write.signal;

start_write(){

if ((read_cnt !=0) || writting) OK_to_write.wait;

writting = 1

}

end_write() {

writting = 0;

if(!empty(OK_to_read)) Ok_to_read.signal;

else OK_to_write.signal

}

}

Assume that there is only a single writter process. that is the function start _write will never be invoked untill the preceeding end_write has terminated.

Solution

I didn\'t get what your question is?

any how plese refer this link

http://courses.cs.vt.edu/~cs5204/fall99/Supplemental/ReadersWriters.html

consider the solution to the readers writers problem. monitor reders/writters { int read_cnt = 0, writting = 0; condition OK_to_read, OK_to_write; start_read(){

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site