I've read alot about Software Transactional Memory, especially with regards to Haskell however i am attempting to figure how it's not the same as database transactions? Exist some advantages I don't understand with STM?

The thought of a "transaction" in software transactional memory is clearly lent from databases. The main difference is how the transactions are implemented and just how they are utilised.

STM is really a language-level concept: a sequence of procedures doesn't work until a transaction is committed. Typically which means that the values of some global/shared variables just have to change whenever a transaction works. The home is enforced through the language runtime. There's no natural perception of persistence: the variables involved with a transaction might be purely dynamic in character (e.g., how big a piece queue).

Database transactions are a credit card applicatoin-level concept: a sequence of information procedures don't take effect before the transaction is committed. As this is a database, persistence is fundamental: this is of "taking effect" within a database would be that the information is held in some persistent store.

You may choose to make use of a database and database transactions to implement a STM-style formula, but you'd lose the convenience and convenience (and most likely generally the performance) of the language-level implementation.

An STM transaction offers quite a bit that is similar to a database transaction. Particularly, from the Acidity qualities vital that you database designers, STM provides Atomicity and Isolation. Consistency, however, can be the programmer&mdashyou can write STM transactions that violate the invariants of internal data structures, for instance. Finally, STM transactions typically aren't Durable answers are saved in volatile RAM, and when the equipment crashes following a effective transaction, the outcomes could be lost. That, i believe, is most likely probably the most salient distinction between an STM transaction along with a database transaction.

STM is mainly employed for concurrency, while database transactions are about data consistency.