118
The test-and-set instruction (cont.)
nMutual exclusion is preserved: if Pi enter CS, the other Pj are busy waiting nWhen Pi exit CS, the selection of the Pj who will enter CS is arbitrary: no bounded waiting. Hence starvation is possible nProcessors (ex: Pentium) often provide an atomic xchg(a,b) instruction that swaps the content of a and b. nBut xchg(a,b) suffers from the same drawbacks as test-and-set