Anonymous user menu

Initial values of Xa and Yb in semaphores

plz explain in detail ????

Sameer Dubey @sameerz567
15 Nov 2014 12:19 pm

Here if Xb semaphore provides mutual exclusion when an operation is performed on S, for eg while you are doing S=S-1 then no other process shoudl do it so we put P(xb) before we perform any operation on S.

The correct answer is (c), becuase with xb=1, one process will enter to edit the value os 'S' and while one process is decrementing the value of 'S' no other process can decreament the value of 'S'..if S<0, no process must further enter the c.s, i.e it must be blocked, to block that process we use Yb with initial value=0, becuase if value of Yb will be one then one process will not block and successfully execute p(Yb);, but before executing p(yb); release Xb so other processes and come and try, so there is V(xb) before p(yb);

Its better to practice more and more questions on this, becuase Synchronisation requires a lot of practice. you have to intutively get the the answer, there is no fixed procedure to solve questions based on synchronisation and it comes through practice