A variable T is the sum of A and B. A and B are each updated by many processes and are protected by individual spinlocks, LA and LB. If a process locks LA to update A, it is also safe to update T at that point.
Added by Lori M.
Step 1
We have T, which is the sum of A and B, and we have two individual spinlocks, LA for A and LB for B. Show more…
Show all steps
Your feedback will help us improve your experience
Adi S and 97 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
[20/20/20/20] <5.5> The 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). addi x2, x0, #1 lockit: EXCH x2, 0(x1) bnez x2, lockit The lock is released simply by storing a 0 into x2. As discussed in Section 5.5, the more optimized spin lock employs cache coherence and uses a load to check the lock, allowing it to spin with a shared var- iable in the cache. lockit: ld x2, 0(x1) bnez x2, lockit addi x2, x0, #1 EXCH x2, 0(x1) bnez x2, lockit Assume that processor cores C0, C1, and C3 are all trying to acquire a lock at address 0xAC00 (i.e., register R1 holds the value 0xAC00). Assume the cache con- tents from Figure 5.37 and the timing parameters from Implementation 1 in Figure 5.38. For simplicity, assume the critical sections are 1000 cycles long. a. [20] <5.5> Using the simple spin lock, determine approximately how many memory stall cycles each processor incurs before acquiring the lock. b. [20] <5.5> Using the optimized spin lock, determine approximately how many memory stall cycles each processor incurs before acquiring the lock. c. [20] <5.5> Using the simple spin lock, approximately how many memory accesses occur? d. [20] <5.5> Using the optimized spin lock, approximately how many memory accesses occur?
Adi S.
5.14 Describe how the compare and swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting requirement. (15 pts)
Haricharan G.
(a) Prove or disprove the following statement: Lamport's mutual exclusion algorithm will work correctly even if channels are not FIFO. (b) Illustrate with an example that under Lamport's mutual exclusion algorithm, a process may not have to wait until its request reaches other processes to access critical section. (c) Prove that under Ricart Agrawala's mutual exclusion algorithm, request for accessing critical section will be satisfied in ascending order of the timestamps of the requests of the processes. (d) Prove or disprove the following statement: Ricart-Agrawla's mutual exclusion algorithm allows a process to access critical section more than once while other processes are waiting to access critical section. (e) Prove or disprove the following statement: Under Suzuki-Kasami's algorithm, a process may enter critical section more than once while other processes are waiting to access critical section (i.e., other processes have pending requests).
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD