The test-and-set spin lock is the simplest synchronization mechanism possible on most commercial shared-memory machines. This spin

Question:

The test-and-set spin lock is the simplest synchronization mechanism possible on most commercial shared-memory machines. This spin lock relies on the exchange primitive to atomically load the old value and store a new value. The lock routine performs the exchange operation repeatedly until it finds the lock unlocked (i.e., the returned value is 0).
The test-and-set spin lock is the simplest synchronization mechanism possible

Unlocking a spin lock simply requires a store of the value 0.

The test-and-set spin lock is the simplest synchronization mechanism possible

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.

The test-and-set spin lock is the simplest synchronization mechanism possible

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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Architecture A Quantitative Approach

ISBN: 978-0123704900

4th edition

Authors: John L. Hennessy, David A. Patterson

Question Posted: