Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a basis software transactional system #81

Merged
merged 2 commits into from
Jan 19, 2017
Merged

Conversation

smarr
Copy link
Owner

@smarr smarr commented Jan 3, 2017

The general idea is that all accesses to objects and arrays are mediated via
Change objects. These keep a copy of the initial state, and a working copy on
which the transactions perform their accesses. On commit, we simply compare the
initial state with the publicly visible objects, if any change (conflict) is
seen the transaction retries. If no conflict was determined, the new state is
copied into the publicly visible object.

Transactions always succeed, this implementation automatically retries.

The initial creation of a Change object accesses the public object while
holding its lock. Similarly, on writing back changes, the lock is acquired.
Transaction commits are globally sequentialized on a single lock.

Method and blocks executed inside a transaction execute an atomic variant of
their method body. All invocable used in the transactional context, i.e.,
within a atomic: [...] execution are split from the normal methods, and
marked as isAtomic. This flag allows to insert the necessary nodes to ensure
that a transaction works on working copies private to the transaction.

To avoid issues with class identity, the slots storing lazily allocated class
objects are ignored when comparing and updating objects.

Inspired by: Transactional Memory for Smalltalk
L. Renggli, and O. Nierstrasz. In Proc. of ICDL, 2007.
DOI: 10.1145/1352678.1352692

@smarr smarr added the enhancement Improves the implementation with something noteworthy label Jan 3, 2017
@smarr smarr force-pushed the threading/transactions branch 2 times, most recently from bde023b to bbdd7de Compare January 19, 2017 15:39
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 79.289% when pulling bbdd7de on threading/transactions into f89d1af on master.

This is just a basic set of tests, nothing really checking transaction correctness with respect to concurrency.

Also, the Transactions module is just a mockup. It does not yet do anything transactional.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
The general idea is that all accesses to objects and arrays are mediated via
`Change` objects. These keep a copy of the initial state, and a working copy on
which the transactions perform their accesses. On commit, we simply compare the
initial state with the publicly visible objects, if any change (conflict) is
seen the transaction retries. If no conflict was determined, the new state is
copied into the publicly visible object.

Transactions always succeed, this implementation automatically retries.

The initial creation of a `Change` object accesses the public object while
holding its lock. Similarly, on writing back changes, the lock is acquired.
Transaction commits are globally sequentialized on a single lock.

Method and blocks executed inside a transaction execute an `atomic` variant of
their method body. All invocable used in the transactional context, i.e.,
within a `atomic: [...]` execution are split from the normal methods, and
marked as `isAtomic`. This flag allows to insert the necessary nodes to ensure
that a transaction works on working copies private to the transaction.

To avoid issues with class identity, the slots storing lazily allocated class
objects are ignored when comparing and updating objects.

Inspired by: Transactional Memory for Smalltalk
L. Renggli, and O. Nierstrasz. In Proc. of ICDL, 2007.
DOI: 10.1145/1352678.1352692

Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr merged commit 9da059a into master Jan 19, 2017
@smarr smarr deleted the threading/transactions branch January 19, 2017 15:49
@smarr smarr added this to the v0.2.0 milestone Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the implementation with something noteworthy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants