Notes [Java7 Concurrency Programming Manual] Chapter III-Thread synchronization helper Classes-Overview

Source: Internet
Author: User
Tags semaphore

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:

    1. Concurrent access Control for resources
    2. Concurrent access control for multiple replicas of a resource
    3. Waiting for multiple concurrent events to complete
    4. Synchronization at the meeting point
    5. Running concurrent-phase tasks
    6. Phase swapping in concurrent-phase tasks
    7. Data exchange between concurrent tasks
Review

In the second chapter, we mainly study the following interfaces

    1. Synchronized keywords
    2. 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.

    1. 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
    2. 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.
    3. 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.
    4. 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.
    5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.