I'm taking an Operating Systems class and stuck on a problem with Semaphores.
Here it is:
Suppose a machine's instruction set includes an instruction named swap that operates as follows (as an indivisible instruction):
swap(boolean *a, boolean *b)
t = *a;
*a = *b;
*b = t;
Show how swap can be used to implement the p and v operations.