skip to main content
research-article
Free Access

x86-TSO: a rigorous and usable programmer's model for x86 multiprocessors

Published:01 July 2010Publication History
Skip Abstract Section

Abstract

Exploiting the multiprocessors that have recently become ubiquitous requires high-performance and reliable concurrent systems code, for concurrent data structures, operating system kernels, synchronization libraries, compilers, and so on. However, concurrent programming, which is always challenging, is made much more so by two problems. First, real multiprocessors typically do not provide the sequentially consistent memory that is assumed by most work on semantics and verification. Instead, they have relaxed memory models, varying in subtle ways between processor families, in which different hardware threads may have only loosely consistent views of a shared memory. Second, the public vendor architectures, supposedly specifying what programmers can rely on, are often in ambiguous informal prose (a particularly poor medium for loose specifications), leading to widespread confusion.

In this paper we focus on x86 processors. We review several recent Intel and AMD specifications, showing that all contain serious ambiguities, some are arguably too weak to program above, and some are simply unsound with respect to actual hardware. We present a new x86-TSO programmer's model that, to the best of our knowledge, suffers from none of these problems. It is mathematically precise (rigorously defined in HOL4) but can be presented as an intuitive abstract machine which should be widely accessible to working programmers. We illustrate how this can be used to reason about the correctness of a Linux spinlock implementation and describe a general theory of data-race freedom for x86-TSO. This should put x86 multiprocessor system building on a more solid foundation; it should also provide a basis for future work on verification of such systems.

References

  1. Linux kernel mailing list, thread "spin_unlock optimization (i386)", 119 messages, Nov. 20--Dec. 7, 1999, http://www.gossamer-threads.com/lists/engine?post=105365;list=linux. Accessed 2009/11/18.Google ScholarGoogle Scholar
  2. The SPARC Architecture Manual, V. 8. SPARC International, Inc., 1992. Revision SAV080SI9308. http://www.sparc.org/standards/V8.pdf. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. AMD64 Architecture Programmer's Manual (3 vols). Advanced Micro Devices, Sept. 2007. rev. 3.14.Google ScholarGoogle Scholar
  4. Intel 64 architecture memory ordering white paper, 2007. Intel Corporation. SKU 318147-001.Google ScholarGoogle Scholar
  5. Intel 64 and IA-32 Architectures Software Developer's Manual (5 vols). Intel Corporation, Mar. 2010. rev. 34.Google ScholarGoogle Scholar
  6. Adve, S. Gharachorloo, K. Shared memory consistency models: A tutorial. IEEE Comput. 29, 12 (Dec. 1996), 66--76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Adve, S.V., Boehm, H.-J. Memory models: A case for rethinking parallel languages and hardware. C. ACM, To appear.Google ScholarGoogle Scholar
  8. Adve, S.V., Hill, M.D. A unified formalization of four shared-memory models. IEEE Trans. Parallel Distrib. Syst. 4, 6 (1993), 613--624. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ahamad, M., Neiger, G., Burns, J., Kohli, P., Hutto, P. Causal memory: Definitions, implementation, and programming. Distrib. Comput. 9, 1 (1995), 37--49.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Aspinall, D., Ševčík J. Formalising Java's data race free guarantee. In Proc. TPHOLs, LNCS 4732 (2007), 22--37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Boehm, H.-J., Adve, S. Foundations of the C++ concurrency memory model. In Proceedings of PLDI (2008). Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Boudol, G., Petri, G. Relaxed memory models: An operational approach. In Proceedings of POPL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Burckhardt, S., Musuvathi, M. Effective program verification for relaxed memory models. Technical Report MSR-TR-2008-12, Microsoft Research, 2008. Conference version in Proceedings of CAV, LNCS 5123 (2008). Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Burckhardt, S., Musuvathi, M., Singh, V. Verifying compiler transformations for concurrent programs, Jan. 2009. Technical report MSR-TR-2008-171.Google ScholarGoogle Scholar
  15. Dice, D. Java memory model concerns on Intel and AMD systems. http://blogs.sun.com/dave/entry/java_memory_model_concerns_on, Jan. 2008.Google ScholarGoogle Scholar
  16. Friedman, R. Consistency conditions for distributed shared memories. Israel Institute of Technologic, 1994.Google ScholarGoogle Scholar
  17. Gharachorloo, K. Memory consistency models for shared-memory multiprocessors. WRL Res. Rep. 95, 9 (1995). Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Hangal, S., Vahia, D., Manovit, C., Lu, J.-Y.J., Narayanan, S. TSOtool: A program for verifying memory systems using the memory consistency model. In Proceedings of ISCA (2004), 114--123. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Higham, L., Kawash, J., Verwaal, N. Weak memory consistency models part I: Definitions and comparisons. Technical Report98/612/03, Department of Computer Science, The University of Calgary, January, 1998. Full version of a paper in PDCS 1997.Google ScholarGoogle Scholar
  20. The HOL 4 system. http://hol.sourceforge.net/.Google ScholarGoogle Scholar
  21. Lamport, L. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput. C-28, 9 (1979), 690--691. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Loewenstein, P.N., Chaudhry, S., Cypher, R., Manovit, C. Multiprocessor memory model verification. In Proceedings of AFM (Automated Formal Methods) (Aug. 2006). FLoC workshop. http://fm.csl.sri.com/AFM06/.Google ScholarGoogle Scholar
  23. Luchango, V.M. Memory consistency models for high-performance distributed computing. PhD thesis, MIT, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Manson, J., Pugh, W., Adve, S. The Java memory model. In Proceedings of POPL (2005). Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Milner, R. Communication and Concurrency. Prentice Hall International, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Owens, S. Reasoning about the implementation of concurrency abstractions on x86-TSO. In Proceedings of ECOOP (2010). To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Owens, S., Sarkar, S., Sewell, P. A better x86 memory model: x86-TSO. In Proceedings of TPHOLs, LNCS 5674 (2009), 391--407. Full version as Technical Report UCAM-CL-TR-745, Univ. of Cambridge. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Park, S., Dill, D.L. An executable specification and verifier for relaxed memory order. IEEE Trans. Comput. 48, 2 (1999), 227--235. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Roy, A., Zeisset, S., Fleckenstein, C.J., Huang, J.C. Fast and generalized polynomial time memory consistency verification. In CAV (2006), 503--516. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Saraswat, V., Jagadeesan, R., Michael, M., von Praun, C. A theory of memory models. In Proceedings of PPoPP (2007). Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Sarkar, S., Sewell, P., Zappa Nardelli, F., Owens, S., Ridge, T., Braibant, T., Myreen, M., Alglave, J. The semantics of x86-CC multiprocessor machine code. In Proceedings of POPL 2009 (Jan. 2009). Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Sindhu, P.S., Frailong, J.-M., Cekleov, M. Formal specification of memory models. In Scalable Shared Memory Multiprocessors, Kluwer, 1991, 25--42.Google ScholarGoogle Scholar
  33. Ševčík, J., Aspinall, D. On validity of program transformations in the Java memory model. In ECOOP (2008), 27--51. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. x86-TSO: a rigorous and usable programmer's model for x86 multiprocessors

                  Recommendations

                  Comments

                  Login options

                  Check if you have access through your login credentials or your institution to get full access on this article.

                  Sign in

                  Full Access

                  • Published in

                    cover image Communications of the ACM
                    Communications of the ACM  Volume 53, Issue 7
                    July 2010
                    133 pages
                    ISSN:0001-0782
                    EISSN:1557-7317
                    DOI:10.1145/1785414
                    Issue’s Table of Contents

                    Copyright © 2010 ACM

                    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                    Publisher

                    Association for Computing Machinery

                    New York, NY, United States

                    Publication History

                    • Published: 1 July 2010

                    Permissions

                    Request permissions about this article.

                    Request Permissions

                    Check for updates

                    Qualifiers

                    • research-article
                    • Popular
                    • Refereed

                  PDF Format

                  View or Download as a PDF file.

                  PDF

                  eReader

                  View online with eReader.

                  eReader

                  HTML Format

                  View this article in HTML Format .

                  View HTML Format