Question about third solution of reader


Question about third solution of reader and writer problem:
Could any one explain the solution in detail. I dont understand the use of the semaphore no_waiting.

A solution :
semaphores: no_waiting, no_accessing, counter_mutex ( initial value is 1 ) 
shared variables: nreaders ( initial value is 0 ) 
local variables: prev, current

WRITER:
P( no_waiting );
P( no_accessing );
V( no_waiting );
... write ...
V( no_accessing );

READER:
P( no_waiting );
P( counter_mutex );
prev := nreaders;
nreaders := nreaders + 1;
V( counter_mutex );
if prev = 0 then P( no_accessing );
V( no_waiting );
... read ...
P( counter_mutex );
nreaders := nreaders - 1;
current := nreaders;
V( counter_mutex );
if current = 0 then V( no_accessing ); 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Question about third solution of reader
Reference No:- TGS082120

Expected delivery within 24 Hours