The meaning of hard work is that in the days to come, you will see only people and things you like!
Issues and Pull requests are welcome. All documents are coded by myself. If you think they are good, you are welcome to star them for encouragement and support:)
The entire series of articles is about Java concurrency . Firstly, it is my own interest. Secondly, this part is very difficult to understand in practice. In addition, it is often asked during the interview process. Therefore, during the learning process, I recorded the basic knowledge related to Java concurrency. First, I can establish a system for my knowledge, and I also hope that it will be useful to others.
About Java concurrency topics:
(1) Contains the basic knowledge of concurrency, and each title links to a specific article;
(2) Contains interview questions for autumn recruitment. Understanding them will help you gain something (and I hope everyone can find your favorite job:) )
(3) During the reading process, if it is helpful, please give me a thumbs up, which is an encouragement for my persistence in coding.
Note: Please indicate the original source when reprinting, thank you!
basic knowledge
1.1 Advantages and disadvantages of concurrent programming
Knowledge points: (1) Why use concurrency? (Advantages); (2) Disadvantages of concurrent programming; (3) Confusing concepts
1.2 Thread status and basic operations
Knowledge points: (1) How to create a new thread; (2) Thread state conversion; (3) Basic operations of threads; (4) Daemon thread;
Concurrency Theory (JMM)
Java memory model and happens-before rules
Knowledge points: (1) JMM memory structure; (2) Reordering; (3) happens-before rules
Concurrency keyword
3.1 Let you fully understand Synchronized
Knowledge points: (1) How to use synchronized; (2) monitor mechanism; (3) synchronized happens-before relationship; (4) synchronized memory semantics; (5) lock optimization; (6) lock upgrade strategy
3.2 Let you fully understand volatile
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 understand final?
Knowledge points: (1) How to use; (2) final reordering rules; (3) final implementation principle; (4) final references cannot "overflow" from the constructor (this escape)
3.4 Summary of three major properties: atomicity, orderliness, and visibility
Knowledge points: (1) Atomicity: synchronized; (2) Visibility: synchronized, volatile; (3) Orderliness: synchronized, volatile
Lock system
4.1 First introduction to Lock and AbstractQueuedSynchronizer (AQS)
Knowledge points: (1) Comparison between Lock and synchronized; (2) AQS design intent; (3) How to use AQS to implement custom synchronization components; (4) Overridable methods; (5) Template methods provided by AQS;
4.2 In-depth understanding of AbstractQueuedSynchronizer (AQS)
Knowledge points: (1) Data structure of AQS synchronization queue; (2) Exclusive lock; (3) Shared lock;
4.3 Understand ReentrantLock again
Knowledge points: (1) The implementation principle of reentrant lock; (2) The implementation principle of fair lock; (3) The implementation principle of unfair lock; (4) Comparison between fair lock and unfair lock
4.4 In-depth understanding of read-write lock ReentrantReadWriteLock
Knowledge points: (1) How to represent read and write status; (2) Acquisition and release of WriteLock; (3) Acquisition and release of ReadLock; (4) Lock degradation strategy; (5) Generating Condition waiting queue; (6) Application scenarios
4.5 Detailed explanation of Condition’s await and signal waiting/notification mechanisms
Knowledge points: (1) Characteristics compared with Object’s wait/notify mechanism; (2) Methods corresponding to Object’s wait/notify; (3) Underlying data structure; (4) Await implementation principle; (5) Signal/signalAll implementation principle; (6) Combination of await and signal/signalAll;
4.6 LockSupport tool
Knowledge points: (1) Main functions; (2) Characteristics compared with synchronized blocking wake-up;
concurrent container
5.1 Concurrent container ConcurrentHashMap (JDK version 1.8)
Knowledge points: (1) key attributes; (2) important internal classes; (3) involved CAS operations; (4) construction methods; (5) put execution process; (6) get execution process; (7) expansion mechanism ; (8) Execution process of the method for counting size; (9) Comparison between version 1.8 ConcurrentHashMap and previous versions
5.2 CopyOnWriteArrayList of concurrent container
Knowledge points: (1) Implementation principle; (2) The difference between COW and ReentrantReadWriteLock; (3) Application scenarios; (4) Why there is weak consistency; (5) Disadvantages of COW;
5.3 ConcurrentLinkedQueue of concurrent container
Knowledge points: (1) Implementation principle; (2) Data structure; (3) Core method; (4) Design intention of HOPS delayed update
5.4 ThreadLocal of concurrent container
Knowledge points: (1) Implementation principle; (2) Set method principle; (3) Get method principle; (4) Remove method principle; (5) ThreadLocalMap
An article that explains the ThreadLocal memory leak problem in depth from the source code.
Knowledge points: (1) ThreadLocal memory leak principle; (2) ThreadLocal best practices; (3) Application scenarios
5.5 BlockingQueue of concurrent container
Knowledge points: (1) Basic operations of BlockingQueue; (2) Commonly used BlockingQueue;
Detailed explanation of the implementation principles of ArrayBlockingQueue and LinkedBlockingQueue in concurrent containers
Thread pool (Executor system)
6.1 Thread pool implementation principle
Knowledge points: (1) Why use thread pool? (2) Execution process; (3) The meaning of each parameter of the constructor; (4) How to close the thread pool; (5) How to configure the thread pool;
6.2 ScheduledThreadPoolExecutor of thread pool
Knowledge points: (1) Class structure; (2) Common methods; (3) ScheduledFutureTask; (3) DelayedWorkQueue;
6.3 Summary of basic operations of FutureTask
Knowledge points: (1) Several states of FutureTask; (2) get method; (3) cancel method; (4) application scenarios; (5) implementing the Runnable interface
Atomic operation class
7.1 Summary of atomic operation classes in the atomic package in Java
Knowledge points: (1) Implementation principle; (2) Atomic update basic type; (3) Atomic update array type; (4) Atomic update reference type; (5) Atomic update field type
Concurrency tools
8.1 In plain English, Java concurrency tool classes-CountDownLatch, CyclicBarrier
Knowledge points: (1) CountDownLatch; (2) CyclicBarrier; (3) Comparison between CountDownLatch and CyclicBarrier
8.2 Java concurrency tool classes in vernacular - Semaphore, Exchanger
Knowledge points: (1) Resource access control Semaphore; (2) Data exchange Exchanger
Concurrency practice
9.1 An article that allows you to thoroughly understand the producer-consumer issue
JAVA Concurrency Knowledge Graph
You can move to a new window to enlarge for better viewing or view the original image.
Link to the original image of the knowledge graph. If it is useful, you can clone it for your own use.