March 2003
Intermediate to advanced
912 pages
27h 17m
English
Many computers have instructions which perform read, conditional modify and write of a memory location within a single bus cycle; that is, they provide an atomic, conditional update of a memory location. With such an instruction we can implement mutual exclusion on a multiprocessor. One example is a test-and-set (TAS) instruction which is typically of the form:
| TAS BOOLEAN | if the boolean indicates that the region is free
then set it to indicate busy and skip the next instruction else execute the next instruction |
If the boolean was free it is now set to busy and the process enters its critical region. If the boolean was busy, the next instruction in sequence is executed (see Figures 10.5 and 10.6). The ...