preface


Concurrent programming options include multi-process, multi-thread, and multi-coroutine.

For Java, it doesn’t “fork” multiple processes at runtime by calling Linux’s system API, as C++ does. Nor is it like Go, which natively provides multiple coroutines at the language level. In Java, concurrency is a multithreaded mode.

Prior to JDK1.5, Java only provided simple thread exclusion and synchronization mechanisms at the language level, namely the synchronized keyword, wait, and notify. Complex multithreaded programming scenarios require developers to solve complex thread synchronization problems based on these simple mechanisms. Since JDK 1.5, Concurrent programming master Doug Lea has introduced a systematic and comprehensive Concurrent programming framework, the JDK Concurrent package, which includes atomic operations, thread-safe containers, thread pools, and asynchronous programming.

Based on JDK 7 and JDK 8, this book provides a comprehensive source analysis of the entire Concurrent package. Most of the concurrency features in JDK 8 are implemented the same as in JDK 7, but some additional features have been added. Examples are CompletableFuture, new implementations of ConcurrentHashMap, StampedLock, LongAdder, etc.

  • Directory shows

content

  • Multithreading basics

The 384-page Java Concurrency implementation principle: JDK source Code Analysis, forward + comment, click here to get free screenshot!

  • Atomic classes

Starting with this chapter, we will walk through the entire Concurrent package hierarchy step by step, from simple to complex and from bottom to top, as shown in the figure.

  • The Lock with the Condition

  • Synchronization tool class

In addition to locks and conditions, the Concurrent package also provides a series of synchronization utility classes. Some of the principles of these synchronization tool classes are also based on AQS, while others require special implementation mechanisms. This chapter will analyze the implementation principles of all synchronization tool classes.

  • Concurrent container

Lock-free queues and lock-free stacks based on CAS have been introduced in Lock and Phaser implementations. This chapter provides a comprehensive overview of the various Concurrent containers provided by the Concurrent package.

  • Thread pools and futures

The implementation principle of thread pool, class inheritance system, core data structure, graceful closing of thread pool, analysis of task execution process, four rejection strategies of thread pool

  • ForkJoinPool

ForkJoinPool uses ——- algorithm

  • Completabl eFuture

Starting with JDK 8, a powerful asynchronous programming tool, Compl etableFuture, is available in the Concurrent package. Prior to JDK8, asynchronous programming was possible through thread pools and futures, but it wasn’t powerful enough. With the advent of Complet ABL eFuture, Java’s asynchronous programming capabilities have taken a big step forward.

Before exploring the principle of CompletableFut ure, let’s take a closer look at the use of Compl etableFuture to see how it improves over the previous future.

The book is 384 pages long. All chapters have been shown here. For copywriting reasons, they are presented in the form of pictures

The last

Multithreading and concurrency is one of those things that every coder needs to learn at some point. JDK source code analysis from the basis of the thread step by step with your in-depth understanding of multi-threading, concurrent, if you want to learn that this document is suitable for you, due to space constraints can only be shown so, need friends to help comment + forward, click here with screenshots can be obtained free!