Safety of Deferred Update
in Transactional Memory
Abstract
Transactional memory allows the user to declare sequences of instructions as speculative transactions that can either commit or abort. If a transaction commits, it appears to be executed sequentially, so that the committed transactions constitute a correct sequential execution. If a transaction aborts, none of its instructions can affect other transactions.
The popular criterion of opacity requires that the views of aborted transactions must also be consistent with the global sequential order constituted by committed ones. This is believed to be important, since inconsistencies observed by an aborted transaction may cause a fatal irrecoverable error or waste of the system in an infinite loop. Intuitively, an opaque implementation must ensure that no intermediate view a transaction obtains before it commits or aborts can be affected by a transaction that has not started committing yet, so called deferred-update semantics.
In this paper, we intend to grasp this intuition formally. We propose a variant of opacity that explicitly requires the sequential order to respect the deferred-update semantics. Unlike opacity, our property also ensures that a serialization of a history implies serializations of its prefixes. Finally, we show that our property is equivalent to opacity if we assume that no two transactions commit identical values on the same variable, and present a counter-example for scenarios when the “unique-write” assumption does not hold.
1 Introduction
Resolving conflicts in an efficient and consistent manner is the most challenging task in concurrent software design. Transactional memory (TM) [11, 18] addresses this challenge by offering an interface in which sequences of shared-memory instructions can be declared as speculative transactions. The underlying idea, borrowed from databases, is to treat each transaction as an atomic event: a transaction may either commit in which case it appears as executed sequentially, or abort in which case none of its update instructions affect other transactions. The user can therefore design software having only sequential semantics in mind and let the memory take care of conflicts resulting from potentially concurrent executions.
In databases, a correct implementation of concurrency control should guarantee that committed transactions constitute a serial (or sequential) execution [9]. On the other hand, uncommitted transactions can be aborted without invalidating the correctness of committed ones. (In the literature on databases, the latter feature is called recoverability.)
In the TM context, intermediate states witnessed by an incomplete transaction may affect the application through the outcome of its read operations. If the intermediate state is not consistent with any sequential execution, the application may experience a fatal irrecoverable error or sink in an infinite loop. The correctness criterion of opacity [7, 8] addresses this issue by requiring the states observed by uncommitted transactions to be consistent with a global serial execution constituted by committed ones (a serialization).
An opaque TM implementation must, intuitively, ensure that no transaction can read from a transaction that has not started committing yet. This is usually referred to as the deferred-update semantics, and it was in fact explicitly required in some representations of opacity [6]. The motivation of this paper is to capture this intuition formally.
We present a new correctness criterion called du-opacity. Informally, a du-opaque (possibly, non-serial) execution must be indistinguishable from a totally-ordered execution, with respect to which no transaction reads from a transaction that has not started committing.
We further check if our correctness criterion is a safety property, as defined by Owicki and Lamport [17], Alpern and Schneider [2] and refined by Lynch [16]. We show that du-opacity is prefix-closed: every prefix of a du-opaque history is also du-opaque. We also show that du-opacity is, under certain restrictions, limit-closed. More precisely, assuming that, in an infinite execution, every transaction completes each of the operations it invoked (but possibly neither commits nor aborts), the infinite limit of any sequence of ever extending du-opaque histories is also du-opaque. To prove that such an implementation is du-opaque, it is thus sufficient to prove that all its finite histories are du-opaque. To the best of our knowledge, this paper contains the first non-trivial proof of limit-closure for a TM correctness property. We further show that any du-opaque serialization of a history implies a serialization of any of its prefixes that maintains the original read-from relations, which is instrumental in the comparison of du-opacity with opacity.
Opacity, as defined in [8], reduces correctness of an infinite history to correctness of all its prefixes, and thus is limit-closed by definition. In fact, we show that extending opacity to infinite histories in a non-trivial way (i.e., requiring that even infinite histories should have proper serializations), does not result in a limit-closed property. We observe that opacity does not preclude scenarios in which a transaction reads from a future transaction (cf. example in Figure 4), and, thus, our criterion is strictly stronger than opacity. Surprisingly, this is true even if we assume that all transactional operations are atomic, which somewhat attenuates earlier attempts to forcefully introduce the deferred-update in the definition of opacity for atomic operations [6]. However, we show that opacity and du-opacity are equivalent if we assume that no two transactions try to commit identical values on the same data item.
We believe that these results improve our understanding of the very notion of correctness in transactional memory. Our correctness criterion explicitly declares that a transaction is not allowed to read from a transaction that has not started committing yet, and we conjecture that it is simpler to verify. We present the first non-trivial proof for both limit- and prefix-closure of TM histories, which is quite interesting in its own right, for it enables reasoning about possible serializations of an infinite TM history based on serializations of its prefixes.
The paper is organized as follows. In Section 2, we introduce our basic model definitions and recall the notion of safety [17, 2, 16]. In Section 3, we define our criterion of du-opacity and show that it is prefix-closed and under certain restrictions, a limit-closed property. In Section 4, we prove that du-opacity is a proper subset of the original notion of opacity [8], and that it coincides with du-opacity under the “unique-writes” condition.
2 Model
A transactional memory (in short, TM) supports atomic transactions for reading and writing on a set of transactional objects (in short, t-objects). A transaction is a sequence of accesses (reads or writes) to t-objects; each transaction has a unique identifier .
A transaction may contain the following t-operations, each being a matching pair of invocation and response events:
-
1.
read returns a value in some domain or a special value (abort);
-
2.
write, for a value , returns okk or ;
-
3.
tryCk returns (commit) or ; and
-
4.
tryAk returns .
The read set (resp., the write set) of a transaction , denoted , is the set of t-objects that reads in ; the write set of , denoted , is the set of t-objects writes to in .
We consider an asynchronous shared-memory system in which processes communicate via transactions. A TM implementation provides processes with algorithms for implementing , , and of a transaction .
A history of a TM implementation is a (possibly infinite) sequence of invocation and response events of t-operations.
For every transaction identifier , denotes the subsequence of restricted to events of transaction . If is non-empty, we say that participates in , and let denote the set of transactions that participate in . In an infinite history , we assume that each , is finite; i.e., transactions do not issue an infinite number of t-operations.
Two histories and are equivalent if and for every transaction , .
A history is sequential if every invocation of a t-operation is either the last event in or is immediately followed by a matching response.
A history is well-formed if for all , is sequential and has no events after or . We assume that all histories are well-formed, i.e., the client of the transactional memory never invokes a t-operation before receiving a response from the previous one and does not invoke any t-operation after receiving or . We also assume, for simplicity, that the client invokes a at most once within a transaction . This assumption incurs no loss of generality, since a repeated read can be assigned to return a previously returned value without affecting the history’s correctness.
A transaction is complete in if ends with a response event. The history is complete if all transactions in are complete in .
A transaction is t-complete if ends with or ; otherwise, is t-incomplete. is committed (resp., aborted) in if the last event of is (resp., ). The history is t-complete if all transactions in are t-complete.
For t-operations , we say that precedes in the real-time order of , denoted , if the response of precedes the invocation of .
Similarly, for transactions , we say that precedes in the real-time order of , denoted , if is t-complete in and the last event of precedes the first event of in . If neither nor , then and overlap in . A history is t-sequential if there are no overlapping transactions in .
For simplicity of presentation, we assume that each history begins with an “imaginary” transaction that writes initial values to all t-objects and commits before any other transaction begins in .
Let be a t-sequential history. For every operation in , we define the latest written value of as follows:
-
1.
If contains a preceding , then the latest written value of is the value of the latest such write to .
-
2.
Otherwise, if contains a , precedes , and commits in , then the latest written value of is the value of the latest such write to in . (This write is well-defined since starts with writing to all t-objects.)
We say that is legal in a t-sequential history if it returns the latest written value of , and is legal if every in that does not return is legal in .
Definition 1 ([2, 16]).
A property is a set of (transactional) histories. A property is a safety property if it satisfies:
-
1.
Prefix-closure: every prefix of a history is also in and
-
2.
Limit-closure: for any infinite sequence of finite histories such that for all , and is a prefix of , the infinite history that is the limit of the sequence is also in .
Notice that the set of histories produced by a TM implementation is prefix-closed. Therefore, every infinite history of is the limit of an infinite sequence of ever-extending finite histories of . Thus, to prove that satisfies a safety property , it is enough to show that all finite histories of are in . Indeed, limit-closure of then implies that every infinite history of is also in .
3 DU-Opacity
In this section, we introduce our correctness criterion, du-opacity, and prove that a restriction of it is a limit-closed property.
Definition 2.
Let be any history. A completion of , denoted , is a history derived from as follows:
-
•
for every incomplete t-operation of in , if , insert somewhere after the invocation of ; otherwise, if , insert or somewhere after the last event of .
-
•
for every complete transaction that is not t-complete, insert after the last event of transaction .
Let be any history and be a legal t-complete t-sequential history that is equivalent to some completion of . Let be the total order on transactions in .
For any that does not return , let denote the prefix of up to the response of and denotes the prefix of up to the response of . Let denote the subsequence of derived by removing from the events of all transactions such that does not contain an invocation of . We refer to as the local serialization for with respect to and .
We are now ready to present our correctness condition, du-opacity.
Definition 3.
A history is du-opaque if there is a legal t-complete t-sequential history such that
-
(1)
there exists a completion of that is equivalent to , and
-
(2)
for every pair of transactions , if , then , i.e., respects the real-time ordering of transactions in , and
-
(3)
each in that does not return is legal in .
We then say that is a (du-opaque) serialization of . Let denote the sequence of transactions in and denote the transaction in this sequence.
Informally, a history is du-opaque if there exists a legal t-sequential history that is equivalent to , respects the real-time ordering of transactions in and every t-read is legal in its local serialization with respect to and . The third condition reflects the implementation’s deferred-update semantics, i.e., the legality of a t-read in a serialization does not depend on transactions that start committing after the response of the t-read.
An example of a du-opaque history is presented in Figure 1. Let be the t-complete t-sequential history such that and is equivalent to ( is its own completion). It is easy to see that is legal and respects the real-time order of transactions in . We now need to prove that each t-read performed in has a local serialization with respect to in that is legal. Consider in ; since is t-complete in , it follows that is legal in (local serialization for with respect to and ). Similarly, since are t-complete in , is legal in (local serialization for with respect to and ) Thus, is a du-opaque serialization of .
For a history , let be the finite prefix of of length , i.e., consisting of the first events of . Now we show a property of du-opaque histories that is going to be instrumental in the rest of the paper.
Lemma 1.
Let be a du-opaque history and be a serialization of . For any , there exists a serialization of , such that is a subsequence of .
Proof.
Given , and , we construct a t-complete t-sequential history as follows:
-
•
for every transaction that is t-complete in , .
-
•
for every transaction that is complete but not t-complete in , consists of the sequence of events in , immediately followed by .
-
•
for every transaction with an incomplete t-operation in , is the sequence of events in up to the invocation of , immediately followed by .
-
•
for every transaction with an incomplete t-operation , .
By the above construction, is indeed a t-complete history and every transaction that appears in also appears in . Now we order transactions in so that is a subsequence of .
Note that is derived from events contained in some completion of that is equivalent to . Since contains events from every complete t-operation in and other events included are borrowed from , there exists a completion of that is equivalent to .
We now prove that is a serialization of . First we observe that respects the real-time order of . Indeed, if , then and . Since is a subsequence of , we have .
To show that is legal, suppose, by way of contradiction, that there is some that returns in such that is not the latest written value of in . If contains a preceding such that and is not the latest written value for in , it is also not the latest written value for in , which is a contradiction. Thus, the only case to consider is when should return a value written by another transaction.
Since is a serialization of , there exists a committed transaction that performs the last that precedes in in . Moreover, since is legal in the local serialization for in with respect to , the prefix of up to the response of must contain an invocation of . Thus, and . By construction of , and is committed in .
We have assumed, towards a contradiction, that is not the latest written value for in . Hence, there exists a committed transaction that performs in such that . But this is not possible since is a subsequence of .
Thus, is a legal t-complete t-sequential history equivalent to some completion of . Now, by the construction of , for every that does not return in , we have . Indeed, the transactions that appear before in are those with a tryC event before the response of in and are committed in . Since is a subsequence of , we have . Thus, is legal in . ∎
Lemma 1 implies that every prefix of a du-opaque history has a du-opaque serialization and thus:
Corollary 2.
DU-Opacity is a prefix-closed property.
We show, however, that du-opacity is, in general, not limit-closed. We present an infinite history that is not du-opaque, but every its prefix is.
Proposition 1.
DU-Opacity is not a limit-closed property.
Proof.
Let denote a finite prefix of of length . Consider an infinite history that is the limit of the histories defined as follows (see Figure 2):
-
–
Transaction performs a and then invokes that is incomplete in .
-
–
Transaction performs a that overlaps with and returns .
-
–
There are infinitely many transactions , , each of which performing a single that returns such that each overlaps with both and .
A t-complete t-sequential history is derived from the sequence in which (1) is completed by inserting immediately after its invocation and (2) any incomplete is completed by inserting immediately after its invocation. It is easy to observe that is indeed a serialization of .
However, there is no serialization of . Suppose that such a serialization exists. Since every transaction that participates in must participate in , there exists such that . Consider the transaction at index , say in . But for any , must precede in any serialization (by legality), which is a contradiction. ∎
We next prove that du-opacity is limit-closed if we assume that, in an infinite history, every transaction eventually completes (but not necessarily t-completes).
The proof uses König’s Path Lemma on a rooted directed graph, . Let be the root vertex of . We say that , a vertex of , is reachable from , if there is a sequence of vertices such that for each , there exists an edge from to . is connected if every vertex in is reachable from . is finitely branching if every vertex in has a finite out-degree. is infinite if the set of vertices in is not finite.
Lemma 3 (König’s Path Lemma [13]).
If is an infinite connected finitely branching rooted directed graph, then contains an infinite sequence of vertices such that is the root, for every , there is an edge from to , and for every , .
We first prove the following lemma concerning du-opaque serializations.
For a transaction , we define the live set of in , denoted ( included) as follows: every transaction such that neither the last event of precedes the first event of in nor the last event of precedes the first event of in is contained in . We say that transaction succeeds the live set of and we write if in , for all , is complete and the last event of precedes the first event of .
Lemma 4.
Let be a finite du-opaque history and assume be a complete transaction in such that every transaction in is complete in . Then there exists a serialization of such that for all ; , we have .
Proof.
Since is du-opaque, there exists a serialization of .
Let be a t-complete t-sequential history such that , and . We now perform the following procedure iteratively to derive from . Initially . For each , let denote the earliest transaction in such that . If (implying is not t-complete), then move to immediately precede in .
By construction, is equivalent to and for all ; , We claim that is a serialization of . Observe that any two transactions that are complete in , but not t-complete are not related by real-time order in . By construction of , for any transaction , the set of transactions that precede in , but succeed in are not related to by real-time order. Since respects the real-time order in , this holds also for .
We now show that is legal. Consider any performed by some transaction that returns in and let be the earliest transaction in such that . Suppose, by contradiction, that is not legal in . Thus, there exists a committed transaction that performs in such that or . Note that, by our assumption, . Since must be legal in the local serialization of with respect to , . Thus, . Therefore . Moreover, is complete, and since it commits in , it is also t-complete in and the last event of precedes the first event of in , i.e., . Hence, cannot precede in —a contradiction.
Observe also that since is complete in but not t-complete, does not contain an invocation of . Thus, the legality of any other transaction is unaffected by moving to precede in . Thus, is a legal t-complete t-sequential history equivalent to some completion of . The above arguments also prove that every t-read in is legal in its local serialization with respect to and and, thus, is a serialization of . ∎
Theorem 5.
Under the restriction that in any infinite history , every transaction is complete, du-opacity is a limit-closed property.
Proof.
We are given an infinite sequence of finite ever-extending du-opaque histories, let be the corresponding infinite limit history. We want to show that is also du-opaque. By Corollary 2, every prefix of is du-opaque. Therefore, we can assume the sequence of du-opaque histories to be , where each is the prefix of of length .
We construct a rooted directed graph as follows:
-
(0)
The root vertex of is ( where and contain the initial transaction .
-
(1)
Each non-root vertex of is a tuple , where is a du-opaque serialization of that satisfies the condition specified in Lemma 4: for all ; , . Note that there exist several possible serializations for any . For succinctness, in the rest of this proof, when we refer to a specific , it is understood to be associated with the prefix of .
-
(2)
We say that a transaction is complete in with respect to , where is any extension of if last step of in is a response event and it is contained in .
Let , , denote the subsequence of reduced to transactions that are complete in with respect to . For every pair of vertices and in , there is an edge from to if .
The out-degree of a vertex in is defined by the number of possible serializations of , bounded by the number of possible permutations of the set , implying that is finitely branching.
By Lemma 1, given any serialization of , there exists a serialization of such that is a subsequence of . Indeed, the serialization of also respects the restriction specified in Lemma 4. Since contains every complete transaction that takes its last step in in , . Therefore, for every vertex , there is a vertex such that . Thus, we can iteratively construct a path from to every vertex in , implying that is connected.
We now apply König’s Path Lemma to . Since is an infinite connected finitely branching rooted directed graph, we can derive an infinite sequence of non-repeating vertices
such that .
The rest of the proof explains how to use to construct a serialization of . We begin with the following claim concerning .
Claim 6.
For any , .
Proof.
Recall that is a prefix of , and is a prefix of . Also, is a subsequence of . Hence, is a subsequence of . But, is a subsequence of . Thus, is a subsequence of . Inductively, for any , is a subsequence of . But is the subsequence of reduced to transactions that are complete in with respect to . Thus, is indeed equal to . ∎
Let be defined as follows: , For every integer , let
Thus, .
Claim 7.
The function is total and bijective.
Proof.
(Totality and surjectivity)
Since each transaction is complete in some prefix of , for each , there exists such that . By Claim 6, for any , . Since a transaction that is complete in w.r.t is also complete in w.r.t , it follows that for every , , with . By construction of and the assumption that each transaction is complete in , there exists such that each is complete in with respect to and precedes in every transaction whose first event succeeds the last event of each in . Indeed, this implies that for each , there exists such that ; .
This shows that for every , there are ; , such that for every , . Thus, for every , there is such that .
(Injectivity)
If and are transactions at indices , of the same , then clearly implies . Suppose is the transaction at index in some and is the transaction at index in some . For every and , if , then since . If and , it follows from the definition that . Similar arguments for the case when prove that if , then . ∎
By Claim 7, is an infinite sequence of transactions. Let be a t-complete t-sequential history such that and for each t-complete transaction in , ; and for transaction that is complete, but not t-complete in , consists of the sequence of events in , immediately followed by . Clearly, there exists a completion of that is equivalent to .
Let be the prefix of of length , and be the prefix of such that .
Claim 8.
Let be a subsequence of reduced to transactions in such that each is complete in with respect to . Then, for every , there is such that is a serialization of .
Proof.
Let be the shortest prefix of (from ) such that for each , if , then for every , . From the construction of , such and exist. Also, we observe that and is a subsequence of . Using arguments similar to the proof of Lemma 1, it follows that is indeed a serialization of . ∎
Since is complete, there is exactly one completion of , where each transaction that is not t-complete in is completed with after its last event. By Claim 8, the limit t-sequential t-complete history is equivalent to this completion, is legal, respects the real-time order of , and ensures that every read is legal in the corresponding local serialization. Thus, is a serialization of . ∎
From Theorem 5, it follows that:
Corollary 9.
Let be any TM implementation that ensures that in every infinite history of , each transaction is complete in . Then, is du-opaque iff every finite history of is du-opaque.
4 Comparison with Other TM Consistency Definitions
4.1 Relation to Opacity
In this section, we relate du-opacity with opacity, as defined by Guerraoui and Kapalka [8]. Note that the definition presented in [8] applies to any object with a sequential specification. For the sake of comparison, we restrict it here to TMs with read-write semantics.
Definition 4 (Guerraoui and Kapalka [7, 8]).
A finite history is final-state opaque if there is a legal t-complete t-sequential history , such that
-
(1)
for any two transactions , if , then , and
-
(2)
is equivalent to a completion of (cf. Definition 2).
We say that is a final-state serialization of .
Figure 3 presents a t-complete sequential history , demonstrating that final-state opacity is not a prefix-closed property. is final-state opaque, with being a legal t-complete t-sequential history equivalent to . Let be a prefix of in which and are t-incomplete. By Definition 2, () is completed by inserting immediately after the last event of in . Observe that neither nor are sequences that allow us to derive a serialization of (we assume that the initial value of is ).
A restriction of final-state opacity, which we refer to as opacity, was presented in [8] by filtering out histories that are not prefix-closed.
Definition 5 (Guerraoui and Kapalka [8]).
A history is opaque if and only if every finite prefix of (including itself if it is finite) is final-state opaque.
It can be easily seen that opacity is prefix and limit-closed, and, thus, opacity is a safety property.
Proposition 2.
There is an opaque history that is not du-opaque.
Proof.
Consider the finite history depicted in Figure 4. To prove that is opaque, we proceed by examining every prefix of .
-
1.
Each prefix up to the invocation of is trivially final-state opaque.
-
2.
Consider the prefix, of where the event is the response of . Let be a t-complete t-sequential history derived from the sequence by inserting immediately after the invocation of . It is easy to see that is a final-state serialization of .
-
3.
Consider the t-complete t-sequential history derived from the sequence in which each transaction is t-complete in . Clearly, is a final-state serialization of .
Since and every (proper) prefix of it are final-state opaque, is opaque.
Clearly, the only final-state serialization of is specified by . Consider in ; since , the prefix of up to the response of does not contain an invocation of , the local serialization for with respect to and , is . But is not legal in —contradiction. Thus, is not du-opaque. ∎
Theorem 10.
DU-Opacity Opacity.
Proof.
We first claim that every finite du-opaque history is opaque. Let be a finite du-opaque history. By definition, there exists a final-state serialization of . Since du-opacity is a prefix-closed property, every prefix of is final-state opaque. Thus, is opaque.
Again, since every prefix of a du-opaque history is also du-opaque, by Definition 5, every infinite du-opaque history is also opaque.
Proposition 2 now establishes that du-opacity is indeed a restriction of opacity. ∎
We now show that du-opacity is equivalent to opacity assuming that no two transactions write identical values to the same t-object (“unique-write” assumption).
Let Opacityut Opacity, be a property defined as follows:
-
(1)
an infinite opaque history Opacityut iff every transaction is complete in , and
-
(2)
an opaque history Opacityut iff for any two transactions that perform and respectively, .
Theorem 11.
Opacityut=DU-Opacity.
Proof.
We show first that every finite history Opacityut is also du-opaque. Let be any finite opaque history such that for any two transactions that perform and respectively,
Since is opaque, there exists a final-state serialization of . Suppose by contradiction that is not du-opaque. Thus, there exists a that returns a value in that is not legal in , the local serialization for with respect to and . Let and denote the prefixes of and resp. up to the response of in and resp.. Recall that the local serialization for with respect to and , is defined as the subsequence of that does not contain events of any transaction if does not contain an invocation of . Since is legal in , there exists a committed transaction that performs that is the latest such write in that precedes . Thus, if is not legal in , the only possibility is that . Under the assumption of unique writes, there does not exist any other transaction that performs . Consequently, there does not exist any (some completion of ) and (t-complete t-sequential history) such that is equivalent to and contains any committed transaction that writes to i.e. is not final-state opaque. However, since is opaque, every prefix of must be final-state opaque—contradiction.
4.2 Relation with Other definitions
Explicitly using the deferred-update semantics in an opacity definition was first proposed by Guerraoui et al. [6] and later adopted by Kuznetsov and Ravi [14]. In both papers, opacity is only defined on sequential histories, where every invocation of a t-operation is immediately followed by a matching response. In particular, these definitions require the final-state serialization to respect the read-commit order: is opaque by their definition if there exists a final-state serialization of such that if a t-read of a t-object by a transaction precedes the tryC of a transaction that commits on in , then precedes in . But we observe that this definition is not equivalent to opacity even for sequential histories. In fact the property defined in [6] is strictly stronger than du-opacity: the sequential history in Figure 5 is du-opaque (and consequently opaque by Theorem 10). We can derive a du-opaque serialization for this history such that . In fact, this is the only final-state serialization for . However, by the above definition, must precede in any serialization of this history since the response of precedes the invocation of tryC. Thus, is not opaque by the definition in [6].
The recently introduced TMS2 correctness condition [5, 15] is another attempt to clarify opacity. Two transactions are said to conflict in a given history if they access the same t-object and at least one of them successfully commits to it. Informally, for each history in TMS2, there exists a final-state serialization of such that if two transactions and conflict on t-object in , where and tryC of precedes the tryC of , then must precede in . We conjecture that every history in TMS2 is du-opaque, but not vice-versa. Figure 6 depicts a history that is du-opaque, but not TMS2. Indeed, there exists a du-opaque serialization of such that . On the other hand, and are in conflict, commits before , but there does not exist any final-state serialization of in which precedes .
5 Discussion
It is widely accepted that a correctness condition on a set of histories should be a safety property, i.e., should be prefix- and limit-closed. The definition of opacity proposed in [8] forcefully achieves prefix-closure by restricting final-state opacity to prefix-closed histories, and trivially achieves limit-closure by reducing correctness of an infinite history to correctness of its prefixes.
This paper proposes a correctness criterion that explicitly disallows reading from an uncommitted transaction, which ensures prefix-closure and (under the restriction that every transaction eventually completes every operation it invokes, but not neccesarily commits or aborts) limit-closure. We believe that this constructive definition is useful to TM practitioners, since it streamlines possible implementations of t-read and tryC operations. Moreover, it seems that du-opacity already captures the sets of histories exported by most existing opaque TM implementations [4, 10, 3]. In contrast, the recent pessimistic STM implementation [1], in which no transaction aborts, does not intend to provide the deferred-update semantics and, thus, is not in the focus of this paper. Technically, the pessimistic STM of [1] is not opaque, and certainly, not du-opaque.
To the best of our knowledge, there is no prior work proving that any TM correctness property is a safety property in the formal sense. The argumentation in the proof of Theorem 5 is inspired by the proof sketch in [16] of the safety of linearizability [12], but turns out to be trickier due to the more complicated definition of du-opacity.
Acknowledgements
The authors are grateful to the anonymous reviewers for insightful comments on the previous versions of this paper, and Victor Luchangco for interesting discussions.
This work was supported by the European Union Seventh Framework Programme (FP7/2007-2013) under grant agreement Number 238639, ITN project TRANSFORM, and grant agreement Number 248465, the S(o)OS project.
References
- [1] Yehuda Afek, Alexander Matveev, and Nir Shavit. Pessimistic software lock-elision. In DISC, pages 297–311, 2012.
- [2] Bowen Alpern and Fred B. Schneider. Defining liveness. Information Processing Letters, 21(4):181–185, October 1985.
- [3] Luke Dalessandro, Michael F. Spear, and Michael L. Scott. Norec: streamlining stm by abolishing ownership records. In Proceedings of the 15th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP ’10, pages 67–78, New York, NY, USA, 2010. ACM.
- [4] Dave Dice, Ori Shalev, and Nir Shavit. Transactional locking ii. In In Proc. of the 20th Intl. Symp. on Distributed Computing, 2006.
- [5] Simon Doherty, Lindsay Groves, Victor Luchangco, and Mark Moir. Towards formally specifying and verifying transactional memory. Electron. Notes Theor. Comput. Sci., 259:245–261, December 2009.
- [6] Rachid Guerraoui, Thomas A. Henzinger, and Vasu Singh. Permissiveness in transactional memories. In DISC, pages 305–319, 2008.
- [7] Rachid Guerraoui and Michal Kapalka. On the correctness of transactional memory. In PPOPP, pages 175–184, 2008.
- [8] Rachid Guerraoui and Michal Kapalka. Principles of Transactional Memory,Synthesis Lectures on Distributed Computing Theory. Morgan and Claypool, 2010.
- [9] Vassos Hadzilacos. A theory of reliability in database systems. J. ACM, 35(1):121–145, 1988.
- [10] Maurice Herlihy, Victor Luchangco, Mark Moir, and William N. Scherer, III. Software transactional memory for dynamic-sized data structures. In Proceedings of the twenty-second annual symposium on Principles of distributed computing, PODC ’03, pages 92–101, New York, NY, USA, 2003. ACM.
- [11] Maurice Herlihy and J. Eliot B. Moss. Transactional memory: architectural support for lock-free data structures. SIGARCH Comput. Archit. News, 21(2):289–300, 1993.
- [12] Maurice Herlihy and Jeannette M. Wing. Linearizability: A correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst., 12(3):463–492, 1990.
- [13] Dénes König. Theorie der Endlichen und Unendlichen Graphen: Kombinatorische Topologie der Streckenkomplexe. Akad. Verlag. 1936.
- [14] Petr Kuznetsov and Srivatsan Ravi. On the cost of concurrency in transactional memory. CoRR, abs/1103.1302, 2011.
- [15] Mohsen Lesani, Victor Luchangco, and Mark Moir. Putting opacity in its place. In WTTM, 2012.
- [16] Nancy A. Lynch. Distributed Algorithms. Morgan Kaufmann, 1996.
- [17] Susan S. Owicki and Leslie Lamport. Proving liveness properties of concurrent programs. ACM Trans. Program. Lang. Syst., 4(3):455–495, 1982.
- [18] Nir Shavit and Dan Touitou. Software transactional memory. In PODC ’95: Proceedings of the fourteenth annual ACM symposium on Principles of distributed computing, pages 204–213, 1995.