O'Reilly logo

Programming Concurrency on the JVM by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Software Transactional Memory

The separation of identity from state helps STM solve the two major concerns with synchronization: crossing the memory barrier and preventing race conditions. We’ll first look at STM in the context of Clojure and then use it in Java.

Clojure removes the menacing details of memory synchronization (see Programming Clojure [Hal09] and The Joy of Clojure [FH11]) by placing access to memory within transactions. Clojure keenly watches over and coordinates the activities of threads. If there are no conflicts—for example, threads working with different accounts—then no locks are involved, and there are no delays, resulting in maximum concurrency. When two threads try to access the same data, the transaction manager steps ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required