Chapter 7. Software Transactional Memory

 

"Everybody who learns concurrency and thinks they understand it, ends up finding mysterious races they thought weren't possible, and discovers that they didn't actually understand it yet after all."

 
 --Herb Sutter

While investigating the fundamental primitives of concurrency in Chapter 2, Concurrency on the JVM and the Java Memory Model, we recognized the need for protecting parts of the program from shared access. We saw that a basic way of achieving this isolation is the synchronized statement, which uses intrinsic object locks to ensure that at most a single thread executes a specific part of the program at the same time. The disadvantage of using locks is that they can easily cause deadlocks, a situation ...

Get Learning Concurrent Programming in Scala - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.