|
|
C++ Move Semantics for Exception Safety and Optimization in Software Transactional Memory Libraries
Justin Gottschlich, Jeremy Siek, Daniel A. Connors.
Proceedings of the 2008 International Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS 2008)
July,
2008.
|
The goal of transactional memory (TM) is to reduce the complexity of
parallel programming. Software transactional memory (STM) is an effective
near-term solution for gaining experience with transactional memory and
taking advantage of its benefits. STM systems rely on either traditional
lock-based synchronization or non-blocking techniques. While non-blocking
techniques offer natural scalability, the lock-based approaches require
fewer changes to user-defined data structures. Some lock-based STM libraries
rely on user-defined copy assignment operators during the commit phase of a
transaction (under the deferred update policy) or during the abort phase of
a transaction (under the direct update policy). Unfortunately, such
operations may throw exceptions and prevent the commit or abort from
completing, thereby leaving the program in a partially-committed or
inconsistent state. In
this paper we present a solution to this problem: our STM library moves
objects back to global memory instead of copying them. The move operation
transfers the resources of the source object to the target object and then
zeroes out the source object. Implementing move operations in an exception
safe manner is straightforward. The ability to move objects is a new feature
in the next version of the C++ standard, supported by the addition of rvalue
references. We demonstrate our solution within DracoSTM, a C++ lock-based
STM library, and present a performance comparison of move versus copy for
both direct and deferred updating.
|
| [ PDF ] |
|