Channels ▼


There Are Transactions, Then There Are Transactions

Every now and then, a term or technology—even an established one—sneaks up and slips by. Take "transactions," for instance. Transactions are something we all do every day, but other than making sure the barrista forks over exact change, we don't give much thought to them. When it comes to software, however, there are lots of different kinds of transactions: Faircom's c-tree Server includes online transaction processing to guarantee ACID (atomicity, consistency, isolation, and durability); Microsoft's Transaction Server is a COM-based transaction processing system; Java sports a Transaction API; and Oracle's Berkeley DB is a transactional database engine, to mention a few.

Then there's Falcon (, a transactional storage engine based on the Netfrastructure database engine, but extended and integrated into MySQL (and mentioned on page 20 of this issue by Jim Starkey, its designer). What's interesting about Falcon is that it is a transactional database engine designed from the ground up with multicore processors and threading in mind. It also supports Multi-Version Concurrency Control (MVCC), another 1980-era technology for concurrent access to databases.

These days, it seems that "transaction" and "concurrency" go hand-in-hand. Considering its stake in concurrency, it's no surprise that Intel has latched on to the concept of "software transactional memory" (STM), a technology that's been around since the early 1990s when Nir Shavit and Dan Touitou published their paper "Software Transactional Memory." Since then, STM has found its way into any number of environments, ranging from Smalltalk, C/C++, and C#, to Python, Perl, .NET, and Java, among others.

Clearly, from Intel's perspective, STM—or anything else that supports and promotes concurrency—is a good thing. Which is why the company added STM runtime libraries and transactional language construct extensions to its C++ compiler ( According to Intel, transactional memory simplifies parallel programming by supporting "atomic" and "isolated" execution of user-specified tasks. Intel goes on to say (and I paraphrase) that parallel programming traditionally used locks to synchronize concurrent access to shared data. But lock-based synchronization has known pitfalls: Using locks for fine-grain synchronization and composing code that already uses locks are both difficult and prone to deadlock. Transactional memory provides an alternative to locks as a general-purpose concurrency control mechanism. This alternate concurrency control mechanism avoids these pitfalls, thus easing parallel programming. (Locks, synchronization, and concurrency are topics that Herb Sutter tackles on page 57 of this issue.)

But transactional computing isn't just limited to databases and compilers, as Calum Grant points out in his article "Transactional Programming" on page 46 of this issue. Calum applies database concepts to C++ programming. And, as he says, "By copying the database approach, C++ can also implement transactions. It provides guarantees of atomic behavior, it can help in complex error-recovery situations, and allows smaller functions to be composed into larger transactions."

Transactional programming isn't limited to C++. Not only is it done with general-purpose languages, but also with special-purpose ones designed with transactions in mind. For instance, Atomos (, a program language developed by Brian Carlstrom et al. at the Stanford University Computer Systems Lab, purports to be the first programming language with implicit transactions, strong atomicity, and a scalable multiprocessor implementation. According to its designers, Atomos is derived from Java, but replaces Java's synchronization and conditional waiting constructs with simpler transactional alternatives. Consequently, Atomos simplifies the writing of parallel programs utilizing transactional memory. The Atomos virtual machine uses violation handlers to recover from expected violations without necessarily rolling back. According to its developers, the performance benefits and simplicity of coding compared to Java demonstrate the value of programming with transactions.

The list could go on and on I suppose, but its time for me to head over to the coffee shop and initiate a transaction of my own.

Jonathan Erickson


[email protected]

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.