Preemption Adaptivity in Time-Published Queue-Based Spin Locks

  • Bijun He
  • William N. SchererIII
  • Michael L. Scott
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3769)


The proliferation of multiprocessor servers and multithreaded applications has increased the demand for high-performance synchronization. Traditional scheduler-based locks incur the overhead of a full context switch between threads and are thus unacceptably slow for many applications. Spin locks offer low overhead, but they either scale poorly (test-and-set style locks) or handle preemption badly (queue-based locks). Previous work has shown how to build preemption-tolerant locks using an extended kernel interface, but such locks are neither portable to nor even compatible with most operating systems.

In this work, we propose a time-publishing heuristic in which each thread periodically records its current timestamp to a shared memory location. Given the high resolution, roughly synchronized clocks of modern processors, this convention allows threads to guess accurately which peers are active based on the currency of their timestamps. We implement two queue-based locks, MCS-TP and CLH-TP, and evaluate their performance relative to traditional spin locks on a 32-processor IBM p690 multiprocessor. These results show that time-published locks make it feasible, for the first time, to use queue-based spin locks on multiprogrammed systems with a standard kernel interface.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Anderson, T.E., Bershad, B.N., Lazowska, E.D., Levy, H.M.: Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism. ACM Trans. on Computer Systems 10(1), 53–79 (1992)CrossRefGoogle Scholar
  2. 2.
    Black, D.L.: Scheduling support for concurrency and parallelism in the Mach operating system. IEEE Computer 23(5), 35–43 (1990)Google Scholar
  3. 3.
    Craig, T.S.: Building FIFO and priority-queueing spin locks from atomic swap. Technical Report TR 93-02-02, Department of Computer Science, Univ. of Washington (February 1993)Google Scholar
  4. 4.
    Edler, J., Lipkis, J., Schonberg, E.: Process management for highly parallel UNIX systems. USENIX Workshop on Unix and Supercomputers (September 1988)Google Scholar
  5. 5.
    Franke, H., Russell, R., Kirkwood, M.: Fuss, futexes and furwocks: Fast userlevel locking in Linux. In: Ottawa Linux Symp. (June 2002)Google Scholar
  6. 6.
    Harris, T., Fraser, K.: Language support for lightweight transactions. In: 18th Conf. on Object-Oriented Programming, Systems, Languages, and Applications (October 2003)Google Scholar
  7. 7.
    He, B., Scherer III, W.N., Scott, M.L.: Preemption adaptivity in time-published queue-based spin locks. Technical Report URCS-867, University of Rochester (May 2005)Google Scholar
  8. 8.
    Herlihy, M.: Wait-free synchronization. ACM Trans. on Programming Languages and Systems 13(1), 124–149 (1991)CrossRefGoogle Scholar
  9. 9.
    Herlihy, M., Luchangco, V., Moir, M.: The repeat offender problem: A mechanism for supporting dynamic-sized, lock-free data structures. In: 16th Conf. on Distributed Computing (October 2002)Google Scholar
  10. 10.
    Herlihy, M., Luchangco, V., Moir, M., Scherer III., W.N.: Software transactional memory for dynamic-sized data structures. In: 22nd ACM Symp. on Principles of Distributed Computing (July 2003)Google Scholar
  11. 11.
    Jayanti, P.: Adaptive and efficient abortable mutual exclusion. In: 22nd ACM Symp. on Principles of Distributed Computing (July 2003)Google Scholar
  12. 12.
    Karlin, A.R., Li, K., Manasse, M.S., Owicki, S.: Empirical studies of competitive spinning for a shared-memory multiprocessor. In: 13th SIGOPS Symp. on Operating Systems Principles (October 1991)Google Scholar
  13. 13.
    Kontothanassis, L.I., Wisniewski, R.W., Scott, M.L.: Scheduler-conscious synchronization. ACM Trans. on Computer Systems 15(1), 3–40 (1997)CrossRefGoogle Scholar
  14. 14.
    Kumar, S., Jiang, D., Chandra, R., Singh, J.P.: Evaluating synchronization on shared address space multiprocessors: Methodology and performance. In: SIGMETRICS Conf. on Measurement and Modeling of Computer Systems (May 1999)Google Scholar
  15. 15.
    Lim, B.-H., Agarwal, A.: Reactive synchronization algorithms for multiprocessors. In: 6th Intl. Conf. on Architectural Support for Programming Languages and Operating Systems (October 1994)Google Scholar
  16. 16.
    Magnusson, P.S., Landin, A., Hagersten, E.: Queue locks on cache coherent multiprocessors. In: 8th Intl. Parallel Processing Symp. (April 1994)Google Scholar
  17. 17.
    Marathe, V.J., Scherer III, W.N., Scott, M.L.: Design Tradeoffs in Modern Software Transactional Memory Systems. In: 7th Workshop on Languages, Compilers, and Run-time Support for Scalable Systems (October 2004)Google Scholar
  18. 18.
    Marsh, B.D., Scott, M.L., LeBlanc, T.J., Markatos, E.P.: First-class user-level threads. In: 13th SIGPOPS Symp. on Operating Systems Principles (October 1991)Google Scholar
  19. 19.
    Mellor-Crummey, J.M., Scott, M.L.: Algorithms for scalable synchronization on shared-memory multiprocessors. ACM Trans. on Computer Systems 9(1), 21–65 (1991)CrossRefGoogle Scholar
  20. 20.
    Michael, M.M.: High performance dynamic lock-free hash tables and list-based sets. In: 14th Symp. on Parallel Algorithms and Architectures (August 2002)Google Scholar
  21. 21.
    Michael, M.M.: Hazard pointers: Safe memory reclamation for lock-free objects. IEEE Trans. on Parallel and Distributed Systems 15(8), 491–504 (2004)CrossRefGoogle Scholar
  22. 22.
    Michael, M.M.: Scalable lock-free dynamic memory allocation. In: SIGPLAN Symp. on Programming Language Design and Implementation (June 2004)Google Scholar
  23. 23.
    Michael, M.M., Scott, M.L.: Nonblocking algorithms and preemption-safe locking on multiprogrammed shared memory multiprocessors. Journal of Parallel and Distributed Computing 51, 1–26 (1998)MATHCrossRefGoogle Scholar
  24. 24.
    Ousterhout, J.K.: Scheduling techniques for concurrent systems. In: 3rd Intl. Conf. on Distributed Computing Systems (October 1982)Google Scholar
  25. 25.
    Scherer III, W.N., Scott, M.L.: Advanced Contention Management for Dynamic Software Transactional Memory. In: 24th ACM Symp. on Principles of Distributed Computing (July 2005)Google Scholar
  26. 26.
    Scott, M.L.: Non-blocking timeout in scalable queue-based spin locks. In: 21st ACM Symp. on Principles of Distributed Computing (July 2002)Google Scholar
  27. 27.
    Scott, M.L., Scherer III, W.N.: Scalable queue-based spin locks with timeout. In: 8th ACM Symp. on Principles and Practice of Parallel Programming (June 2001)Google Scholar
  28. 28.
    Sundell, H., Tsigas, P.: NOBLE: A non-blocking inter-process communication library. In: 6th Workshop on Languages, Compilers, and Run-time Support for Scalable Systems (March 2002)Google Scholar
  29. 29.
    Sundell, H., Tsigas, P.: Fast and lock-free concurrent priority queues for multi-thread systems. In: Intl. Parallel and Distributed Processing Symp. (April 2003)Google Scholar
  30. 30.
    Takada, H., Sakamura, K.: A novel approach to multiprogrammed multiprocessor synchronization for real-time kernels. In: 18th Real-Time Systems Symp. (December 1997)Google Scholar
  31. 31.
    Woo, S.C., Ohara, M., Torrie, E., Singh, J.P., Gupta, A.: The Splash-2 programs: Characterization and methodological considerations. In: 22nd Intl. Symp. on Computer Architecture (1995)Google Scholar
  32. 32.
    Zheng, H., Nieh, J.: SWAP: A scheduler with automatic process dependency detection. Networked Systems Design and Implementation (March 2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Bijun He
    • 1
  • William N. SchererIII
    • 1
  • Michael L. Scott
    • 1
  1. 1.Department of Computer ScienceUniversity of RochesterRochesterUSA

Personalised recommendations