I've been reading the Beautiful Concurrency article about Haskell and STM.
The example given is a bank-account transfer.
Its a noddy bank transfer - its between two numbers sitting in heap memory.
The questions this immediately raises in my head are:
how that transfer atomically hits disk. Until a bank transaction is recorded in a persistent - ACID - manner, it hasn't happened in my book. How do people using languages like Haskell - which won't let you do any IO inside an STM - actually really do atomic changes in data that isn't only in volatile memory?
how to distribute this over many machines; how can you have distributed transactions and a scaling sideways application (without IO inside the STM)?
STM is intended for thread synchronisation and communication, not for persistent storage of data. In other words, STM is designed to let threads share data between themselves without deadlocks or race conditions. Or for threads to send signals to each other. Or basically to coordinate thread activities.
If you want persistent data stored on disk, use a database. MySQL, PostgreSQL, Oracle, etc. There's a million to choose from. This is not the problem that STM is designed to solve.
For distributed processing... we're still working on that. I don't follow these things closely enough to comment on how close this is to being a reality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With