From the school to A factory all the way sunshine vicissitudes of life

Please go to www.codercc.com


Github:github.com/CL0610/Java… , welcome issue and Pull request. All documents are coded by myself, if you feel good, welcome to star support 🙂

The whole series of articles is about Java concurrency. Firstly, it is of interest to me, secondly, it is very difficult to understand in practice, and it is often asked in the interview process. Therefore, IN the process of learning, I recorded the basic knowledge related to Java concurrency. First, I can establish a system of knowledge, and I also hope to be fortunate enough to be useful to others.

On Java concurrency:

(1) Contains the basics of concurrency, with each title linked to a specific article;

(2) this is a list of autumn job interview questions that will give you some insight (and good luck finding your dream job 🙂

(3) In the process of reading, if it is helpful, please give a thumbs up, which can be regarded as the encouragement of my code word.

Note: reprint please indicate the original, thank you!

1. Basic knowledge

1.1 Advantages and disadvantages of concurrent programming

Why concurrency? (advantages) (2) Disadvantages of concurrent programming; (3) Confusing concepts

1.2 Thread status and basic operations

(1) How to create a thread; (2) Thread state conversion; (3) Basic operation of thread; (4) Daemon thread Daemon;

2. Concurrency Theory (JMM)

Java memory model and happens-before rules

(1) JMM memory structure; (2) reordering; (3) happens-before rule

3. Concurrent keywords

3.1 Let you thoroughly understand Synchronized

1) How to use synchronized (2) Monitor mechanism; (3) synchronized happens-before relationship; (4) Synchronized memory semantics; (5) Lock optimization; (6) Lock the upgrade policy

3.2 Understand volatile thoroughly

Knowledge points :(1) implementation principle; (2) Derivation of happens-before relationship; (3) Memory semantics; (4) Implementation of memory semantics

3.3 Do you think you really know final?

Knowledge :(1) how to use; (2) Final reordering rules; (3) Final implementation principle; (4) Final references cannot “overflow” from constructors.

3.4 Summary of three properties: atomicity, orderliness and visibility

(1) Atomic: synchronized; (2) visibility: synchronized, volatile; (3) Order: synchronized, volatile

4. Lock system

4.1 meet the Lock and AbstractQueuedSynchronizer (AQS)

(1) Lock and synchronized (2) Design intention of AQS; (3) How to use AQS to achieve custom synchronization components; (4) rewritable methods; (5) Template method provided by AQS;

4.2 understand AbstractQueuedSynchronizer (AQS)

Knowledge points :(1) AQS synchronization queue data structure; (2) exclusive lock; (3) Shared lock;

4.3 Understanding ReentrantLock again

Knowledge :(1) the implementation principle of reentrant lock; (2) The realization principle of fair lock; (3) The realization principle of unfair lock; (4) Comparison between fair lock and unfair lock

4.4 Understanding the Read and WriteLock ReentrantReadWriteLock

(1) How to express read and write state; (2) Access and release of WriteLock; (3) ReadLock get and release; (4) Lock degradation strategy; (5) Generate Condition wait queue; (6) Application scenarios

4.5 Detail the await and signal waiting/notification mechanisms of Condition

(1) The wait/notify mechanism of Object (2) Method corresponding to wait/notify of Object; (3) Underlying data structure; (4) implementation principle of await; (5) The implementation principle of signal/signalAll; (6) the combination of await and signal/signalAll;

4.6 LockSupport tools

Knowledge :(1) main functions; (2) characteristics compared with synchronized blocking awakening;

5. Concurrent containers

5.1 ConcurrentHashMap for Concurrent Containers (JDK 1.8)

Knowledge :(1) key attributes; (2) important inner class; (3) CAS operations involved; (4) Construction method; (5) put execution process; (6) GET execution process; (7) Capacity expansion mechanism; (8) the execution process of the method used to count size; (9) Comparison between 1.8 version of ConcurrentHashMap and previous version

5.2 CopyOnWriteArrayList of a concurrent container

Knowledge points :(1) implementation principle; (2) COW and ReentrantReadWriteLock; (3) Application scenarios; (4) Why there is weak consistency; (5) Disadvantages of COW;

5.3 ConcurrentLinkedQueue of concurrent containers

Knowledge points :(1) implementation principle; (2) Data structure; (3) Core methods; (4) Design intention of HOPS delayed update

5.4 ThreadLocal for concurrent containers

Knowledge points :(1) implementation principle; (2) Principle of SET method; (3) Get method principle; (4) Remove method principle; (5) ThreadLocalMap

The ThreadLocal memory leak problem is explained in detail from the source code

ThreadLocal memory leakage principle; (2) Best practices of ThreadLocal; (3) Application scenarios

5.5 BlockingQueue for concurrent containers

The basic operation of BlockingQueue; (2) Common BlockingQueue;

ArrayBlockingQueue and LinkedBlockingQueue are implemented for concurrent containers

6. Thread pools (Executor system)

6.1 Implementation Principles of thread Pools

Why do you need a thread pool? (2) Execution process; (3) meaning of constructor parameters; (4) how to close the thread pool; (5) how to configure thread pool;

6.2 the ScheduledThreadPoolExecutor of thread pool

Knowledge :(1) class structure; (2) Common methods; (3) ScheduledFutureTask; (3) DelayedWorkQueue;

6.3 FutureTask Basic Operations

(1) Several states of FutureTask; (2) Get method; (3) Cancel method; (4) Application scenarios; (5) Implement Runnable interface

7. Atomic manipulation classes

7.1 Summary of atomic operation classes in the Atomic package in Java

Knowledge points :(1) implementation principle; (2) Basic types of atomic updating; (3) Atomic update array type; (4) Atomic update reference type; (5) Atomic update field type

8. Concurrency tools

Java concurrency tool classes -CountDownLatch, CyclicBarrier

CountDownLatch CountDownLatch (2) CyclicBarrier; (3) Comparison of CountDownLatch and CyclicBarrier

8.2 Java Concurrency tool – Sansaner

1) Resource Access control Semaphore; (2) Data Exchanger

9. Concurrent practices

9.1 An article to make you understand the producer-consumer problem thoroughly

10.JAVA Concurrency Knowledge Graph

Move to a new window, zoom in for a better view or view the original image

Knowledge graph link, if useful, can be cloned for their own use

Java concurrency knowledge graph