Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Chapter 15. Atomic Variables and Nonbloc... > Disadvantages of Locking - Pg. 319

Chapter 15 Atomic Variables and Nonblocking Synchronization Many of the classes in java.util.concurrent , such as Semaphore and Concur- rentLinkedQueue , provide better performance and scalability than alternatives using synchronized . In this chapter, we take a look at the primary source of this performance boost: atomic variables and nonblocking synchronization. Much of the recent research on concurrent algorithms has focused on nonblock- ing algorithms, which use low-level atomic machine instructions such as compare- and-swap instead of locks to ensure data integrity under concurrent access. Non- blocking algorithms are used extensively in operating systems and JVMs for thread and process scheduling, garbage collection, and to implement locks and other concurrent data structures. Nonblocking algorithms are considerably more complicated to design and im- plement than lock-based alternatives, but they can offer significant scalability and liveness advantages. They coordinate at a finer level of granularity and can greatly