1 / 20

Composite Abortable Locks (CALs)

Composite Abortable Locks (CALs). Virendra J Marathe University of Rochester. Mark Moir, Nir Shavit Sun Microsystems Labs. Mutual Exclusion Locks. Used in Multiprocessor synchronization Lock owner gets to execute the critical section Enforces waiting; leads to

ellema
Download Presentation

Composite Abortable Locks (CALs)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Composite Abortable Locks (CALs) Virendra J Marathe University of Rochester Mark Moir, Nir Shavit Sun Microsystems Labs

  2. Mutual Exclusion Locks • Used in Multiprocessor synchronization • Lock owner gets to execute the critical section • Enforces waiting; leads to • Waiting for arbitrary time (real-time systems) • Deadlocks

  3. Timeout Capability – Try locks • Timeout and retry • Obeys real-time constraints • Helps avoid deadlocks (common solution in databases) • CAL is a try-lock

  4. Talk Outline • Motivation • Overview of CALs • A CLH-based CAL • Experimental Results • Conclusion

  5. Motivation: Issues in Try-lock Implementations • Test-and-Set based Backoff locks (BLs) • Fast; easy to implement timeout capability • Don’t scale • Queue based locks (QLs) • Scale very well • Not trivial to implement timeouts • Need separate memory management • High-to-unbounded worst case space overheads

  6. Our Approach • Combine the best features of BLs and QLs • BLs: Low space overhead and no memory management • QLs: Scalability • Key Insights • Need only front part of a QL for scaling • Distribute BL across multiple locations • Key Difficulty • The two algorithms are quite different in structure

  7. Overview of CAL • Fixed-sized Backoff array • Nodes allotted to threads from this array • Threads insert nodes into wait-queue Logical Queue Ptr 1 2 3 4 Backoff Array Tail

  8. Lock Acquisition • Node States: Free (F), Waiting (W), Released (R), Aborted (A) • Node Acquisition (F  W) • Thread selects a node (maybe randomly) • Acquire exclusive ownership using a BL • Enqueue and Wait as per queue mechanism (e.g. CLH, MCS)

  9. Node Release • Write R into node to release lock (W  R) • Write A on timeout (W  A) • Someone else will “reclaim” the node (R  F or A  F) • Write F on timeout (W  F) only if the node was not enqueued

  10. CLH Queue Lock • Node States: Free (F), Waiting (W), Released (R) Lock Owner Ptr W W W R F Dummy CAS Spin on previous Tail W New Thrd

  11. CLH-based CAL Lock Owner CAS Timeout Ver# Ptr F W F A W F W W R F Backoff CAS Tail Thrd B Thrd A Acquire Release Aborts Cleanup

  12. Low Contention Case Performance Problem • Need 2 CASes in the critical path • Acquire Node • Enqueue in wait-queue

  13. Optimization • Eliminate extra CAS in no contention case • Use lsb of Tail to indicate if lock acquired • If not, flip the bit • Otherwise follow the CLH-based CAL algorithm • Switch back to no contention case • If the lock releaser is the Tail, flip (using CAS) Tail to uncontended mode

  14. Experimentation • Aimed at • Scalability, Preemption tolerance, Degradation • Framework • Backoff array of size 4 • 30-processor Sun Enterprise 6000 cache coherent machine with 366MHz UltraSPARC II processors • Critical:Non-critical work  300:300 (nanosecs) • Implementation in C, with Sun’s cc –O5 • Comparison with Scott’s state-of-the-art nonblocking CLH try lock

  15. Scalability

  16. Effect of Preemption

  17. Degradation with lower Timeouts (30 threads)

  18. Conclusion • Introduced the new CAL approach to implement try-locks • Scalable • Constant Space Overhead • No extra memory management needed • Preemption tolerant • No fairness guarantees

  19. Future Work • Scalability: Stress test for huge number of threads • Address fairness problem • Other variants of CALs (e.g. MCS-lock)

  20. Thanks!

More Related