Foreword:
Java has been loved by programmers in recent years, and threads are the cornerstone of the Java platform. As multi-core processors become the standard, to build high-performance applications, effective use of concurrency will become a key step. In any case, it is still very difficult to develop, test, and debug multi-threaded programs; the common situation is that concurrent programs developed seem to work normally, but will fail in extreme cases. In terms of production environment, this situation refers to High load.
And today’s shared Java concurrent programming practice of 81.6k on GitHub, with a solid theoretical foundation and detailed practical technology, can help friends build reliable, scalable and maintainable concurrent applications. It is not simply a list of concurrent APIs and mechanisms. On the contrary, it provides design rules, patterns, and ideal models that make it easier for everyone to build correct and efficient concurrent programs.
In order not to affect the reading, the content of this document is shown in the form of pictures below, but the space is limited and only part of it can be displayed. If you need a "high-definition full pdf version", you can directly click here to get the complete notes .
Chapter 1 Basics:
1. Concurrent (very) brief history
2. Advantages of threads
3. The risk of threads
4. Threads are everywhere
Chapter 2 Thread Safety:
1. What is thread safety
2. Atomicity
3. Lock
4. Use a lock to protect the state
5. Activity and performance
Chapter 3 Shared Objects:
1. Visibility
2. Release and escape
3. Thread closure
4. Security release
Chapter 4 Combination Objects:
1. Design thread-safe classes
2. Instance limits
3. Delegate thread safety
4. Add functionality to existing thread-safe classes
5. Documentation of synchronization strategies
Chapter 5 Building Blocks:
1. Synchronize the container
2. Concurrent containers
3. Blocking queue and producer-consumer model
4. Blocking and interruptible methods
5. Synchronizer
6. Establish an efficient and scalable cache for the calculation results
Chapter VI Task Execution:
1. Perform tasks in threads
2. Executor framework
3. Look for strengthenable parallelism
Chapter 7 Cancellation and Closure:
1. Task cancellation
2. Stop thread-based services
3. Processing abnormal thread termination
4. JVM shutdown
Chapter 8 Application Thread Pool:
1. Implicit coupling between tasks and execution strategies
2. Customize the size of the thread pool
3. 配置ThreadPoolExecutor
4. Extend ThreadPoolExecutor
5. Parallel recursive algorithm
Chapter 9 GUI Application:
1. Why the GUI is single-threaded
2. Short-term GUI tasks
3. Time-consuming GUI tasks
4. Shared data model
5. Other forms of single-threaded subsystems
Chapter 10 Avoiding Activity Dangers:
1. Deadlock
2. Avoid and diagnose deadlock
3. Other dangers of activity
The eleventh chapter performance and scalability:
1. Performance thinking
2. Amdahl's Law
3. Overhead introduced by threads
4. Reduce lock competition
5. Example: Compare the performance of Map
6. Reduce the overhead of context switching
The twelfth chapter test concurrent program:
1. Test for correctness
2. Test performance
3. Avoid the pitfalls of performance testing
4. Test Method Supplement
Chapter Thirteen Explicit Locks:
1. Lock和ReentrantLock
2. Performance considerations
3. Fairness
4. Choose between synchronized and ReentrantLock
5. Read-write lock
The fourteenth chapter to build a custom synchronization tool:
1. Manage state dependencies
2. Use condition queue
3. Explicit Condition Object
4. Anatomy of Synchronizer
5.AbstractQueuedSynchronizer
6. AQS in Synchronizer class of java.util.concurrent
Chapter 15 Atomic Variables and Non-blocking Synchronization Mechanism:
1. Disadvantages of locks
2. Hardware support for concurrency
3. Atomic variable class
4. Non-blocking algorithm
The sixteenth chapter Java storage model:
1. What is the storage model, and what is the use of it
2. Release
3. Initialization Security
4. Sync Annotation
Complete code list:
The above information has been compiled into a complete PDF document. Friends who need this information to learn can directly click here to get it .