The test-and-set spin lock is the simplest synchronization mechanism possible on most commercial shared-memory machines. This spin
Question:
Unlocking a spin lock simply requires a store of the value 0.
As discussed in Section 4.7, the more optimized test-and-test-and-set lock uses a load to check the lock, allowing it to spin with a shared variable in the cache.
Assume that processors P0, P1, and P15 are all trying to acquire a lock at address 0x100 (i.e., register R1 holds the value 0x100). Assume the cache contents from Figure 4.37 and the timing parameters from Implementation 1 in Figure 4.38. For simplicity, assume the critical sections are 1000 cycles long.
a. Using the test-and-set spin lock, determine approximately how many memory stall cycles each processor incurs before acquiring the lock.
b. Using the test-and-test-and-set spin lock, determine approximately how many memory stall cycles each processor incurs before acquiring the lock.
c. Using the test-and-set spin lock, approximately how many bus transactions occur?
d. Using the test-and-test-and-set spin lock, approximately how many bus transactions occur?
Step by Step Answer:
Computer Architecture A Quantitative Approach
ISBN: 978-0123704900
4th edition
Authors: John L. Hennessy, David A. Patterson