Skip to main content
Log in

Trace Semantics and Algebraic Laws for Total Store Order Memory Model

  • Regular Paper
  • Published:
Journal of Computer Science and Technology Aims and scope Submit manuscript

Abstract

Modern multiprocessors deploy a variety of weak memory models (WMMs). Total Store Order (TSO) is a widely-used weak memory model in SPARC implementations and x86 architecture. It omits the store-load constraint by allowing each core to employ a write buffer. In this paper, we apply Unifying Theories of Programming (abbreviated as UTP) in investigating the trace semantics for TSO, acting in the denotational semantics style. A trace is expressed as a sequence of snapshots, which records the changes in registers, write buffers and the shared memory. All the valid execution results containing reorderings can be described after kicking out those that do not satisfy program order and modification order. This paper also presents a set of algebraic laws for TSO. We study the concept of head normal form, and every program can be expressed in the head normal form of the guarded choice which is able to model the execution of a program with reorderings. Then the linearizability of the TSO model is supported. Furthermore, we consider the linking between trace semantics and algebraic semantics. The linking is achieved through deriving trace semantics from algebraic semantics, and the derivation strategy under the TSO model is provided.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Passos L B C, Pfitscher G H, Filho R T M. Performance evaluation of two parallel programming paradigms applied to the symplectic integrator running on COTS PC cluster. In Proc. the 21st Int. Symp. Parallel and Distributed Processing, Mar. 2007, pp.1-8. https://doi.org/10.1109/IPDPS.2007.370563.

  2. Adve S V, Gharachorloo K. Shared memory consistency models: A tutorial. Computer, 1996, 29(12): 66-76. https://doi.org/10.1109/2.546611.

    Article  Google Scholar 

  3. Lamport L. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Computers, 1979, C-28(9): 690-691. https://doi.org/10.1109/TC.1979.1675439.

  4. Sorin D J, Hill M D, Wood D A. A Primer on Memory Consistency and Cache Coherence. Morgan & Claypool Publishers, 2011. https://doi.org/10.2200/S00346ED1V01Y201104CAC016.

  5. Owens S, Sarkar S, Sewell P. A better x86 memory model: x86-TSO. In Proc. the 22nd Int. Conf. Theorem Proving in Higher Order Logics, Aug. 2009, pp.391-407. https://doi.org/10.1007/978-3-642-03359-9_27.

  6. Dongol B, Derrick J, Smith G. Reasoning algebraically about refinement on TSO architectures. In Proc. the 11th Int. Colloquium on Theoretical Aspects of Computing, Sept. 2014, pp.151-168. https://doi.org/10.1007/978-3-319-10882-7_10.

  7. Kang J, Hur C K, Lahav O, Vafeiadis V, Dreyer D. A promising semantics for relaxed-memory concurrency. In Proc. the 44th Symp. Principles of Programming Languages, Jan. 2017, pp.175-189. https://doi.org/10.1145/3009837.3009850.

  8. Sewell P, Sarkar S, Owens S, Nardelli F Z, Myreen M O. x86-TSO: A rigorous and usable programmer’s model for x86 multiprocessors. Communications of the ACM, 2010, 53(7): 89-97. https://doi.org/10.1145/1785414.1785443.

    Article  Google Scholar 

  9. Hoare C A R, He J. Unifying Theories of Programming. Prentice Hall, 1998.

  10. Plotkin G D. A structural approach to operational semantics. Technical Report, Aarhus University, 1981. http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=5155CF1E81938DF7CA5AEE78AA3CCD0D?doi=10.1.1.4.8186-&rep=rep1&type=pdf, Sept. 2021.

  11. Stoy J E. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press, 1981.

  12. Hoare C A R, Hayes I J, He J, Morgan C C, Roscoe A W, Sanders J W, Sorensen I H, Spivey J M, Sufrin B A. Laws of programming. Communications of the ACM, 1987, 30(8): 672-686. https://doi.org/10.1145/27651.27653.

    Article  MathSciNet  MATH  Google Scholar 

  13. Hoare C A R, He J, Sampaio A. Normal form approach to compiler design. Acta Informatica, 1993, 30(8): 701-739. https://doi.org/10.1007/BF01191809.

    Article  MathSciNet  MATH  Google Scholar 

  14. Sampaio A. An Algebraic Approach to Compiler Design. World Scientific, 1997. https://doi.org/10.1142/2870.

  15. Kavanagh R, Brookes S. A denotational semantics for SPARC TSO. In Proc. the 33rd Conf. Mathematical Foundations of Programming Semantics, Jun. 2017, pp.223-239. https://doi.org/10.1016/j.entcs.2018.03.025.

  16. Travkin O, Wehrheim H. Handling TSO in mechanized linearizability proofs. In Proc. the 10th Int. Haifa Verification Conference, Nov. 2014, pp.132-147. https://doi.org/10.1007/978-3-319-13338-6_11.

  17. Winter K, Smith G, Derrick J. Observational models for linearizability checking on weak memory models. In Proc. the 12th Int. Symp. Theoretical Aspects of Software Engineering, Aug. 2018, pp.100-107. https://doi.org/10.1109/TASE.2018.00021.

  18. Tarski A. A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics, 1955, 5(2): 285-309. https://doi.org/10.2140/pjm.1955.5.285.

    Article  MathSciNet  MATH  Google Scholar 

  19. Brookes S D. Full abstraction for a shared-variable parallel language. Information and Computation, 1996, 127(2): 145-163. https://doi.org/10.1006/inco.1996.0056.

    Article  MathSciNet  MATH  Google Scholar 

  20. Hoare C A R. Communicating Sequential Processes. Prentice-Hall, 1985.

  21. Abdulla P A, Aronis S, Atig M F, Jonsson B, Leonardsson C, Sagonas K. Stateless model checking for TSO and PSO. Acta Informatica, 2017, 54(8): 789-818. https://doi.org/10.1007/s00236-016-0275-0.

    Article  MathSciNet  MATH  Google Scholar 

  22. Hóu Z, Sanán D, Tiu A, Liu Y, Hoa K C, Dong J S. An Isabelle/HOL formalisation of the SPARC instruction set architecture and the TSO memory model. Journal of Automated Reasoning, 2021, 65(4): 569-598. https://doi.org/10.1007/s10817-020-09579-4.

    Article  MathSciNet  MATH  Google Scholar 

  23. Khyzha A, Gotsman A. Compositional reasoning about concurrent libraries on the axiomatic TSO memory model. Technical Report, IMDEA Software Institute, 2012. https://pageperso.lis-lab.fr/~pierrealain.reynier/publis/movep12.pdf#page=116, Mar. 2021.

  24. Batty M J. The C11 and C++ 11 concurrency model [Ph.D. Thesis]. Wolfson College, University of Cambridge, Cambridge, 2015.

  25. Ridge T. A Rely-Guarantee proof system for x86-TSO. In Proc. the 3rd Int. Conf. Verified Software: Theories, Tools, and Experiments, Aug. 2010, pp.55-70. 10.1007/978-3-642-15057-9 4.

  26. Kavanagh R, Brookes S. A denotational account of C11-style memory. arXiv:1804.04214, 2018. https://arxiv.org/abs/1804.04214, Mar. 2021.

  27. He J, Hoare C A R. From algebra to operational semantics. Information Processing Letters, 1993, 45(2): 75-80. https://doi.org/10.1016/0020-0190(93)90219-Y.

    Article  MathSciNet  MATH  Google Scholar 

  28. Hoare C A R, Van Staden S. The laws of programming unify process calculi. Science of Computer Programming, 2014, 85: 102-114. https://doi.org/10.1016/j.scico.2013.08.012.

    Article  MATH  Google Scholar 

  29. Hoare C A R. Laws of programming: The algebraic unification of theories of concurrency. In Proc. the 25th Int. Conf. Concurrency Theory, Sept. 2014, pp.1-6. https://doi.org/10.1007/978-3-662-44584-6_1.

  30. Sheng F, Zhu H, He J, Yang Z, Bowen J P. Theoretical and practical approaches to the denotational semantics for MDESL based on UTP. Formal Aspects of Computing, 2020, 32(2): 275-314. https://doi.org/10.1007/s00165-020-00513-4.

    Article  MathSciNet  MATH  Google Scholar 

  31. Sheng F, Zhu H, He J, Yang Z, Bowen J P. Theoretical and practical aspects of linking operational and algebraic semantics for MDESL. ACM Transactions on Software Engineering and Methodology, 2019, 28(3): Article No. 14. https://doi.org/10.1145/3295699.

  32. Zhu H, Yang F, He J, Bowen J P, Sanders J W, Qin S. Linking operational semantics and algebraic semantics for a probabilistic timed shared-variable language. The Journal of Logic and Algebraic Methods Program, 2012, 81(1): 2-25. https://doi.org/10.1016/j.jlap.2011.06.003.

    Article  MathSciNet  MATH  Google Scholar 

  33. Zhu H. Linking the semantics of a multithreaded discrete event simulation language [Ph.D. Thesis]. Institute for Computing Research, London South Bank University, 2005.

  34. Chen Y. Generic composition. Formal Aspects of Computing, 2002, 14(2): 108-122. https://doi.org/10.1007/s001650200031.

    Article  MATH  Google Scholar 

  35. Huet G, Kahn G, Paulin-Mohring C. The Coq proof assistant—A tutorial (Version v8.1). Technical Report, INRIA, 2005. https://coq.inria.fr/distrib/current/refman/, Mar. 2021.

  36. Owre S, Rushby J M, Shankar N. PVS: A prototype verification system. In Proc. the 11th Int. Conf. Automated Deduction, Jun. 1992, pp.748-752. https://doi.org/10.1007/3-540-55602-8_217.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Hui-Biao Zhu.

Supplementary Information

ESM 1

(PDF 120 kb)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Xiao, LL., Zhu, HB. & Xu, QW. Trace Semantics and Algebraic Laws for Total Store Order Memory Model. J. Comput. Sci. Technol. 36, 1269–1290 (2021). https://doi.org/10.1007/s11390-021-1616-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11390-021-1616-1

Keywords

Navigation