AQS(AbstractQueuedSynchronizer) source code

A few days ago, when comparing the relationship and difference between Synchronized and ReentrantLock, and learning to use Semaphore, CountDownLatch and CyclicBarrier, I found that there is such a synchronizer at the bottom layer. This makes me feel that to learn their underlying principles, I have to learn the underlying principles of AQS itse ...

Added by ghazianibros on Sun, 16 Jan 2022 14:35:53 +0200

Notes after reading the art of Java Concurrent Programming - 13 atomic operation classes in Java (Chapter 7)

Notes after reading the art of Java Concurrent Programming - 13 atomic operation classes in Java (Chapter 7) 1. Atomic update basic type class The Atomic package provides the following three classes for updating basic types in an Atomic way: AtomicBoolean: atomic update boolean typeAtomicInteger: atomic update integerAtomicLong: atomic u ...

Added by Ferdog on Fri, 14 Jan 2022 17:21:50 +0200

Java Concurrent Programming Practice - Chapter 2 Thread Security

Catalogue of Series Articles Part I Basic Knowledge Chapter II Thread Security The core of thread security is the management of state access operations, especially access to shared and variable states Object state: Informally, data stored in a state variable (instance or static domain), while the state of an object may include domains ...

Added by Slip on Wed, 12 Jan 2022 19:10:30 +0200

JUC foundation, it's enough to read this article

JUC Foundation 1. Tube side: monitor, monitor, lock It ensures that only one process is active in the pipe at the same time, that is, the operations defined in the pipe are called by only one process at the same time (implemented by the compiler) However, this does not guarantee that the processes are executed in the designed order Synchroni ...

Added by jonniejoejonson on Sun, 09 Jan 2022 06:49:02 +0200

Java Concurrency: a summary of the basic principles of thread pool

1, Why choose a thread pool and create threads when not in use? Pooling Technology: prepare some resources in advance, and reuse these prepared resources when needed. Common pooling technologies include thread pool, memory pool, database connection pool and HttpClient connection pool. As a practice of pooling technology, thread pool is e ...

Added by shauny17 on Thu, 06 Jan 2022 03:33:44 +0200

Java parallel atomic operation class parsing

Java parallel atomic operation class parsingprefaceThe JUC package provides a number of atomic operation classes, which are implemented using the non blocking algorithm CAS. Compared with the atomic operation using locks, the performance is greatly improved.Since the principles of atomic operations are roughly the same, this article only explai ...

Added by MrLister on Thu, 06 Jan 2022 00:04:49 +0200

JAVA Concurrent Programming -- thread waiting wake-up mechanism and LockSupport

1. Overview of thread waiting wake-up mechanism2. The wait and notify methods in the object class implement thread waiting and wake-up3. The await post signal method in the condition interface realizes thread waiting and wake-up4. Restrictions on the use of object and Condition5. Introduction to locksupport class6. park wait and unpark wake-up ...

Added by maxsslade on Sun, 26 Dec 2021 18:31:49 +0200

10. Common auxiliary classes

10.1. CountDownLatch (counter) In the official documents, the explanation of this block is complex. In short, this class is a subtraction counter, which is generally used to calculate the execution times of threads and execute an operation when it reaches 0. For example, suppose there are six students in a class. Now after school, if the ...

Added by daniellynn2000 on Wed, 15 Dec 2021 23:34:31 +0200

Common locks of JUC

1, AtomicInteger/** * @author Java And algorithm learning: Monday */ public class AtomicInteger { //No volatile public AtomicInteger count = new AtomicInteger(0); //No synchronized public void m() { for (int i = 0; i < 1000; i++) { //count++ count.incrementAndGet(); } } pub ...

Added by pt4siek on Wed, 15 Dec 2021 14:08:25 +0200

JUC learning - in depth analysis of thread pool executor (supplementary)

Next blog https://blog.csdn.net/qq_43605444/article/details/121727738?spm=1001.2014.3001.5501 6. Worker class The following is an official comment on the Worker class: /** * Class Worker mainly maintains interrupt control state for * threads running tasks, along with other minor bookkeeping. * This class opportunistically extends Abstr ...

Added by eabigelow on Mon, 06 Dec 2021 07:05:57 +0200