Microsoft has released an experimental enhanced version of .NET Framework 4 Beta 1 that enables software transactional memory for C# programmers, known as STM.NET.
In a blog post about the technology, S. “Soma” Somasegar, senior vice president of Microsoft’s Developer Division, said, “Transactional memory is a technology that frees developers from worrying about the mechanics of fine-grained locking and synchronization in multithreaded applications by providing transactional semantics for reading and writing to memory. It enables developers to focus on application logic instead of the details of memory I/O when building multi-core and many-core programs.”
Dana Groff is the senior program manager for Software Transactional Memory and the Concurrency Runtime in Microsoft’s Developer Division’s Parallel Computing Platform group, in a blog post, said the official name for the STM .NET technology was “.NET Framework 4 Beta 1 Enabled to use Software Transactional Memory V1.0.”
The STM .NET page on the Microsoft DevLabs site says “Software Transactional Memory (STM.NET) is a mechanism for efficient isolation of shared state. The programmer demarcates a region of code as operating within a transaction that is ‘atomic’ and ‘isolated’ from other transacted code running concurrently.”
Moreover, the DevLabs description of STM says:
““Transactional memory is considered a promising technology by the academic community and is repeatedly brought up as a welcome technology for the upcoming wave of applications which scale on modern multi-core hardware. The goal is to be able to exploit concurrency by using components written by experts and consumed by application programmers who can then compose together these components using STM.”“
Eric Newcomer, an independent contractor working in the office of the Chief Technology Officer (CTO) at Progress Software, said of the STM effort, “It isn’t a proven idea yet, that transactions provide an effective alternative for protecting shared memory areas against conflicting updates, but it is a very interesting concept and I think it’s a good thing Microsoft is releasing it for experimentation. There are a few other toolkits out there for this, mostly open source from what I can see, but none of them are integrated into a complete transactional environment the way the Microsoft kit is. I’ll be very interested in the results of this experiment.”
Newcomer knows a bit about the issue of transactions as co-author of “Principles of Transaction Processing, Second Edition,” which was published in June. It is the follow-up to the first edition of the book, which was published in 1997 and has been used as an instructional text in computer science courses. He also was formerly CTO at IONA Technologies and TP Architect at Digital Equipment Corporation.
Added Newcomer:
““The benefits of this model aren’t entirely clear. The transaction paradigm is designed to group operations on data to ensure they either succeed or fail as a unit, such as the debit and credit operations in a bank funds transfer. This toolkit proposes to apply that model as a kind of substitute for locking memory areas to prevent conflicting updates in parallel or concurrent operations on the same data. Unlike traditional disk based transactions, all in memory operations on data are lost if there’s a crash. To prevent this, the user can promote the transaction to a disk based transaction. But then the original idea of providing an alternative for protecting memory only data operations is really changed back to the more traditional model. It may be the case that users have sufficient requirements for protecting memory only data operations from conflicting updates but the questions about this model arise from the fact that it is using the transaction paradigm for a different purpose than it was originally designed for.”“
Somasegar said STM.NET makes it easy to declare a region of code as atomic. And the .NET Framework’s just-in-time compiler rewrites the code within an atomic block to use transactional memory. “As a result, a significant amount of .NET code works without changes, including code that uses locks,” he said. “STM.NET also provides integration with System.Transactions so you can coordinate your atomic memory operations with existing transactional resource managers like MSMQ.”
Moreover, Somasegar said, “One of the best aspects of STM.NET is its integration with Visual Studio tooling. STM.NET works with the Visual Studio 2008 debugger to allow you to see the values of transacted variables as they appear while running inside the Atomic.Do delegate as well as their values as they appear outside.”