Show No Weakness: Sequentially Consistent Specifications of TSO Libraries
Modern programming languages, such as C++ and Java, provide a sequentially consistent (SC) memory model for well-behaved programs that follow a certain synchronisation discipline, e.g., for those that are data-race free (DRF). However, performance-critical libraries often violate the discipline by using low-level hardware primitives, which have a weaker semantics. In such scenarios, it is important for these libraries to protect their otherwise well-behaved clients from the weaker memory model.
In this paper, we demonstrate that a variant of linearizability can be used to reason formally about the interoperability between a high-level DRF client and a low-level library written for the Total Store Order (TSO) memory model, which is implemented by x86 processors. Namely, we present a notion of linearizability that relates a concrete library implementation running on TSO to an abstract specification running on an SC machine. A client of this library is said to be DRF if its SC executions calling the abstract library specification do not contain data races. We then show how to compile a DRF client to TSO such that it only exhibits SC behaviours, despite calling into a racy library.
KeywordsMemory Model Store Buffer Visible Location Data Race Sequentially Consistent
Unable to display preview. Download preview PDF.
- 2.Batty, M., Owens, S., Sarkar, S., Sewell, P., Weber, T.: Mathematizing C++ concurrency. In: POPL (2011)Google Scholar
- 3.Boehm, H.-J., Adve, S.V.: Foundations of the C++ concurrency memory model. In: PLDI (2008)Google Scholar
- 5.Bovet, D., Cesati, M.: Understanding the Linux Kernel, 3rd edn. O’Reilly (2005)Google Scholar
- 6.Burckhardt, S., Gotsman, A., Musuvathi, M., Yang, H.: Concurrent Library Correctness on the TSO Memory Model. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 87–107. Springer, Heidelberg (2012)Google Scholar
- 7.Gotsman, A., Musuvathi, M., Yang, H.: Show no weakness: Sequentially consistent specifications of TSO libraries (extended version) (2012), http://www.software.imdea.org/~gotsman
- 8.Gotsman, A., Yang, H.: Linearizability with Ownership Transfer. In: Ulidowski, I. (ed.) CONCUR 2012. LNCS, vol. 7454, pp. 256–271. Springer, Heidelberg (2012)Google Scholar
- 9.Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. In: TOPLAS (1990)Google Scholar
- 10.Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comp. (1979)Google Scholar
- 11.Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: POPL (2005)Google Scholar