📜 ⬆️ ⬇️

.NET Framework 4.0 received a mechanism for Software Transactional Memory

Software Transactional Memory (STM) is an alternative to locks and other traditional mechanisms for synchronizing asynchronous operations and threads when accessing a shared memory location. The STM mechanism is similar to the work of transactions in modern DBMSs and, although its use is generally slower than using the lock mechanism, the STM offers the developer a simpler way to manage parallel computing.

Using STM in .NET is extremely simple:

Atomic.Do (() => {
<statememts>
});
')
where statements is an expression that must be executed in a transaction.

There are a lot of libraries implementing STM for a variety of languages. The STM for .NET previously existed as a separate project of the Microsoft Research group, besides there are 4 more STM libraries for C #. And now, this mechanism has become part of the framework.

* download .NET 4.0 from STM msdn.microsoft.com/en-us/devlabs/ee334183.aspx
* wiki article about STM en.wikipedia.org/wiki/Software_transactional_memory (eng)
* article Beautiful oncurency (Haskell) research.microsoft.com/en-us/um/people/simonpj/papers/stm/beautiful.pdf (pdf), thanks shai_xylyd

via www.infoq.com/news/2009/07/Software-Transactional-Memory

Source: https://habr.com/ru/post/65591/


All Articles