Stu Smith: Making It Up As I Go Along“ My life working for BinaryComponents, coding, design, and other stuff. ”
Last article I covered my implementation of software transactional memory in C#. If you haven't read those articles yet, in brief, it's a technique where we can write efficient, thread-safe client code without using having to think about locks or events - all isolation, atomicity and signaling is handled by a small set of common routines.
I've presented this technique, and the code, as the realization of an idea that could be taken further - I'm pretty sure it's not ready for production code yet. In this final article, I'll give a link to the source, and cover some pros and cons of this technique.
The articles and source will be kept up-to-date on:
But for convenience, here's links to everything so far:
Part 1: The Problems with Locking
Part 2: Atomicity and Isolation: That Reminds Me Of A Database
Part 3: Implementation
Source: TransactionalMemory.zip
If you have any comments on this technique, please let me know. I'd be particularly interested if anyone uses it in "real" code, as opposed to my simple examples. Additionally, if you're able to overcome any of the "cons" listed, I'd like to know that too.
If you find any bugs, please do let me know, and I'll update the source. (Any bugs in the implementation will of course go to show how bug-prone normal locking techniques are).
If you're interested in multi-threaded coding techniques, you might find the following .NET-related projects and shows interesting: