Notes [Java7 Concurrent Programming manual] series catalogue
A little anxious, not too pay attention to quality, oneself also did not understand thoroughly, from this chapter, the quality of reading and essay notes will be better.
Chapter III
In this chapter, we will learn:
- Concurrent access Control for resources
- Concurrent access control for multiple replicas of a resource
- Waiting for multiple concurrent events to complete
- Synchronization at the meeting point
- Running concurrent-phase tasks
- Phase swapping in concurrent-phase tasks
- Data exchange between concurrent tasks
Review
In the second chapter, we mainly study the following interfaces
- Synchronized keywords
- Lock interfaces and implementation classes, such as Readlock and Writelock in Reentrantlock, Reentrantreadwritelock
Knowledge should have: the use of synchronized keyword, the use of lock interface, in lock lock use conditions, will use read and write locks, will modify the fairness of the lock
This chapter focuses on the following points to learn
In this chapter, you will achieve multi-threaded synchronization with the following more advanced synchronization mechanisms.
- Signal Volume (Semaphore):
is a counter that protects access to one or more shared resources, which is an underlying tool for concurrent programming, and most programming languages provide this mechanism
- Latching (Countdownlatch):
A synchronous helper class that allows one or more threads to wait until a set of operations that are performed in another thread is completed.
- Level (Cyclicbarrier):
A synchronization helper class that allows a set of threads to wait for each other until a common barrier point (common barrier points) is reached.
- Stage Level (Phaser):
JAVA1.7新特性
A synchronous helper class, similar to the Cyclicbarrier barrier, but more flexible than it is, it divides concurrent tasks into multiple phases, and all threads in the current phase must perform before the next phase begins.
- Clearing House (Exchanger)
A synchronization helper class that provides a data exchange point before two threads.
In the application, semaphore can be used at any time to protect the critical section, while other auxiliary classes need to choose the appropriate usage scenario based on their own characteristics.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Notes [Java7 Concurrency Programming Manual] Chapter III-Thread synchronization helper Classes-Overview