An Optimistic Approach to Lock-Free FIFO Queues

  • Edya Ladan-Mozes
  • Nir Shavit
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3274)

Abstract

First-in-first-out (FIFO) queues are among the most fundamental and highly studied concurrent data structures. The most effective and practical dynamic-memory concurrent queue implementation in the literature is the lock-free FIFO queue algorithm of Michael and Scott, included in the standard Java TM Concurrency Package.

This paper presents a new dynamic-memory lock-free FIFO queue algorithm that performs consistently better than the Michael and Scott queue. The key idea behind our new algorithm is a novel way of replacing the singly-linked list of Michael and Scott, whose pointers are inserted using a costly compare-and-swap (CAS) operation, by an “optimistic” doubly-linked list whose pointers are updated using a simple store, yet can be “fixed” if a bad ordering of events causes them to be inconsistent. We believe it is the first example of such an “optimistic” approach being applied to a real world data structure.

Keywords

Prev Pointer FIFO Queue Dummy Node Consecutive Node Empty Queue 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Gottlieb, A., Lubachevsky, B.D., Rudolph, L.: Basic techniques for the efficient coordination of very large numbers of cooperating sequential processors. ACM Trans. Program. Lang. Syst. 5, 164–189 (1983)MATHCrossRefGoogle Scholar
  2. 2.
    Herlihy, M., Wing, J.: Linearizability: A correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems 12, 463–492 (1990)CrossRefGoogle Scholar
  3. 3.
    Hwang, K., Briggs, F.A.: Computer Architecture and Parallel Processing. McGraw-Hill, Inc., New York (1990)Google Scholar
  4. 4.
    Lamport, L.: Specifying concurrent program modules. ACM Transactions on Programming Languages and Systems 5, 190–222 (1983)MATHCrossRefGoogle Scholar
  5. 5.
    Mellor-Crummey, J.M.: Concurrent queues: Practical fetch-and-φ algorithms. Technical Report Technical Report 229, University of Rochester (1987)Google Scholar
  6. 6.
    Prakash, S., Lee, Y.H., Johnson, T.: Non-blocking algorithms for concurrent data structures. Technical Report 91–002, Department of Information Sciences, University of Florida (1991)Google Scholar
  7. 7.
    Prakash, S., Lee, Y.H., Johnson, T.: A non-blocking algorithm for shared queues using compare-and-swap. IEEE Transactions on Computers 43, 548–559 (1994)CrossRefGoogle Scholar
  8. 8.
    Stone, H.S.: High-performance computer architecture. Addison-Wesley Longman Publishing Co., Inc., Amsterdam (1987)Google Scholar
  9. 9.
    Stone, J.: A simple and correct shared-queue algorithm using compare-and-swap. In: Proceedings of the 1990 conference on Supercomputing, pp. 495–504. IEEE Computer Society Press, Los Alamitos (1990)Google Scholar
  10. 10.
    Treiber, R.K.: Systems programming: Coping with parallelism. Technical Report RJ 5118, IBM Almaden Research Center (1986)Google Scholar
  11. 11.
    Tsigas, P., Zhang, Y.: A simple, fast and scalable non-blocking concurrent fifo queue for shared memory multiprocessor systems. In: Proceedings of the thirteenth annual ACM symposium on Parallel algorithms and architectures, pp. 134–143. ACM Press, New York (2001)CrossRefGoogle Scholar
  12. 12.
    Valois, J.: Implementing lock-free queues. In: Proceedings of the Seventh International Conference on Parallel and Distributed Computing Systems, pp. 64–69 (1994)Google Scholar
  13. 13.
    Lea, D.: (The java concurrency package (JSR-166)), http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
  14. 14.
    Michael, M.M., Scott, M.L.: Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In: Proceedings of the 15th Annual ACM Symposium on Principles of Distributed Computing (PODC 1996), pp. 267–275. ACM, New York (1996)CrossRefGoogle Scholar
  15. 15.
    Craig, T.: Building FIFO and priority-queueing spin locks from atomic swap. Technical Report TR 93-02-02, University of Washington, Department of Computer Science (1993)Google Scholar
  16. 16.
    Magnussen, P., Landin, A., Hagersten, E.: Queue locks on cache coherent multiprocessors. In: Proceedings of the 8th International Symposium on Parallel Processing (IPPS), pp. 165–171. IEEE Computer Society, Los Alamitos (1994)CrossRefGoogle Scholar
  17. 17.
    Mellor-Crummey, J., Scott, M.: Algorithms for scalable synchronization on sharedmemory multiprocessors. ACM Transactions on Computer Systems 9, 21–65 (1991)CrossRefGoogle Scholar
  18. 18.
    Weaver, D., T.G.: The SPARC Architecture Manual (Version 9). PTR Prentice Hall, Englewood Cliffs (1994)Google Scholar
  19. 19.
    Intel: Pentium Processor Family User’s Manual: Vol 3, Architecture and Programming Manual (1994)Google Scholar
  20. 20.
    Agesen, O., Detlefs, D., Flood, C., Garthwaite, A., Martin, P., Moir, M., Shavit, N., Steele, G.: DCAS-based concurrent deques. Theory of Computing Systems 35, 349–386 (2002)MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Luchangco, V., Moir, M., Shavit, N.: On the uncontended complexity of consensus. In: Proceedings of Distributed Computing (2003)Google Scholar
  22. 22.
    Herlihy, M., Luchangco, V., Moir, M.: Obstruction-free synchronization: Doubleended queues as an example. In: Proceedings of the 23rd International Conference on Distributed Computing Systems, pp. 522–529. IEEE, Los Alamitos (2003)CrossRefGoogle Scholar
  23. 23.
    Rajwar, R., Goodman, J.: Speculative lock elision: Enabling highly concurrent multithreaded execution. In: Proceedings of the 34th Annual International Symposium on Microarchitecture, pp. 294–305 (2001)Google Scholar
  24. 24.
    Herlihy, M., Luchangco, V., Moir, M.: The repeat offender problem: A mechanism for supporting lock-free dynamic-sized data structures. In: Proceedings of the 16th International Symposium on DIStributed Computing, vol. 2508, pp. 339–353. Springer, Heidelberg (2002); A improved version of this paper is in preparation for journal submission; please contact authorsGoogle Scholar
  25. 25.
    Michael, M.: Safe memory reclamation for dynamic lock-free objects using atomic reads and writes. In: The 21st Annual ACM Symposium on Principles of Distributed Computing, pp. 21–30. ACM Press, New York (2002)Google Scholar
  26. 26.
    Moir, M.: Practical implementations of non-blocking synchronization primitives. In: Proceedings of the 16th Annual ACM Symposium on Principles of Distributed Computing, pp. 219–228 (1997)Google Scholar
  27. 27.
    Cormen, T., Leiserson, C., Rivest, R., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press, Cambridge (2001)MATHGoogle Scholar
  28. 28.
    Afek, Y., Attiya, H., Dolev, D., Gafni, E., Merritt, M., Shavit, N.: Atomic snapshots of shared memory. In: Dwork, C. (ed.) Proceedings of the 9th Annual ACM Symposium on Principles of Distribted Computing, Québec City, Québec, Canada, pp. 1–14. ACM Press, New York (1990)CrossRefGoogle Scholar
  29. 29.
    Herlihy, M.: Wait-free synchronization. ACM Transactions on Programming Languages and Systems (TOPLAS) 13, 124–149 (1991)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Edya Ladan-Mozes
    • 1
  • Nir Shavit
    • 2
  1. 1.Department of Computer ScienceTel-Aviv UniversityIsrael
  2. 2.Sun Microsystems Laboratories and Tel-Aviv University 

Personalised recommendations