Java
229 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- 6.15 CompletableFuturehistorical
CompletableFuture organizes asynchronous computation by running work on separate threads and continuing processing when results become available.
- 6.16 ConcurrentHashMap in JDK 1.7historical
JDK 1.7 ConcurrentHashMap uses segmented locking with arrays and linked lists for concurrent updates. These notes trace the implementation through Segment and HashEntry.
- 6.17 fork_joinhistorical
Fork/Join splits large work into parallel subtasks and combines their results. These notes introduce the framework through limitations of ordinary thread pools.
- 6.18 Exchangerhistorical
Exchanger: Used to exchange data between two threads. The data flow is bidirectional. That is, if there are two threads, Thread1 and Thread2, Thread1 sends one piece of data to Thread2, while Thread2 also sends one piece of data to Thread1.
- 6.19 ReentrantReadWriteLockhistorical
Exclusive locks prevent concurrent readers, while read-write locks allow them. These notes introduce ReentrantReadWriteLock through that need.
- 6.20 Semaphorehistorical
Semaphore limits concurrent resource access through permits. These notes examine fair and nonfair policies and permit acquisition and release.
- 6.21 Kernel-Level Threadhistorical
User-level threads are managed by applications, while kernel threads are visible to and scheduled by the operating system. These notes connect the distinction with Java threads.
- 6.22 Unsafehistorical
Unsafe exposes low-level operations such as direct memory access. These notes introduce them through C pointers and memory allocation and examine why care is required.
- 6.23 Revisiting the JMMhistorical
Processor architectures impose different constraints on memory operations. These notes examine how JMM abstracts those differences through observable execution order.
- 6.24 Lock Optimizationhistorical
Java has introduced several synchronized optimizations. These notes begin with lock elimination and examine how compilers and runtimes reduce synchronization costs.