TSL
instruction. It is also possible to implement mutual exclusion with a SWAP
instruction. Assume that the SWAP
instruction is indivisible (i.e. atomic) and that it swaps the values of two variables. For example: SWAP A B
will swap the values in the variables A
and B
. Show how the SWAP
instruction could be used to implement mutual exclusion. Also, give an argument, similar to the one given in class, that your SWAP
based mutual exclusion works.
section a2
will run before section b2
and that section b2
will run before section c2
.
Thread A |   | Thread B |   | Thread C |
---|---|---|---|---|
1. section a1 |
1. section b1 |
1. section c1 |
Acknowledgment: this content is essentially identical to that developed by Professor Grant Braught for the Spring 2006 Operating Systems course, and I'm grateful for his permission to use it.