1.

The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x in y without allowing any intervening access to the memory location x. Consider the following implementation of P and V functions on a binary semaphore S.

A. The implementation may not work, if context switching is disabled in P
B. Instead of using fetch-and-set, a pair of normal load/ store can be used
C. The implementation of V is wrong
D. The code does not implement a binary semaphore
Answer» B. Instead of using fetch-and-set, a pair of normal load/ store can be used


Discussion

No Comment Found

Related MCQs