Haskell concurrency and persistence

I read the Beautiful Concurrency article on Haskell and STM .

The above example is a bank transfer.

His ebullient bank transfer is his between two numbers sitting in the heap's memory.

The questions that immediately arise in my head are the following:

  • how this transfer atomically gets to disk. Until the bank transaction was recorded in a constant mode - ACID , this did not happen in my book. How do people using languages ​​like Haskell that prevent you from doing IOs inside STM actually actually make atomic changes to data that aren’t just in volatile memory?

  • how to distribute this across many machines; how can you distribute transactions and scale the side application (without input / output inside STM)?

+5
source share
2 answers

STM is intended for synchronization of flows and data exchange, but not for permanent data storage. In other words, STM is designed to allow threads to communicate with each other without deadlocks or race conditions. Or for threads to send signals to each other. Or mainly to coordinate the actions of threads.

If you need persistent data stored on disk, use a database. MySQL, PostgreSQL, Oracle, etc. There are a million to choose from. This is not a problem that STM is designed to solve.

... . , , .

+9

, , Haskell, IO STM, , ?

IO . . ACID "MACID" .

; ( - STM)?

STM Haskell, Cloud Haskell GHC.

+7

All Articles