GATEverse
← GATE CSE 2006

Q61

MCQ2 marks, −0.5

The atomic fetch-and-set x,yx, y instruction unconditionally sets the memory location xx to 11 and fetches the old value of xx in yy without allowing any intervening access to the memory location xx. Consider the following implementation of PP and VV functions on a binary semaphore SS. void P (binary_semaphore *s) { unsigned y; unsigned *x = &(s->value); do { fetch-and-set x, y; } while (y); } void V (binary_semaphore *s) { S->value = 0; } Which one of the following is true?

Sign in to save attempts.

Loading…