JUC learning - AbstractQueuedSynchronizer source code interpretation (AQS)
1, Understanding of AbstractQueuedSynchronizer
AbstractQueuedSynchronizer Abstract queue synchronizer is called AQS for short. It is the basic component to implement the synchronizer. juc the following Lock implementation and some concurrency tool classes are implemented through AQS.
AQS will form all request threads into a CLH queue. When a ...
Posted by Plug-in on Fri, 03 Dec 2021 13:04:56 +0100
JUC learning - delay queue details
1. Basic features of DelayQueue
public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
implements BlockingQueue<E>
DelayQueue delay queue has the characteristics of unbounded queue, blocking queue and priority queue. Let's look at the following separately:
Unbounded queue: put the task object to be execute ...
Posted by bossman on Thu, 02 Dec 2021 00:30:43 +0100
JUC concurrent programming and source code analysis
1, AQS(AbstractQueuedSynchronizer) Abstract queue synchronizer
Pre knowledge:
Fair lock and unfair lockReentrant lockSpin lockLockSupportLinked list of data structureTemplate design mode of design mode
1.1 what is it?
Abstract queue synchronizer It is a heavyweight basic framework used to build locks or other synchronizer components and ...
Posted by johnnyboy16 on Tue, 30 Nov 2021 18:46:37 +0100
Source code analysis of ConcurrentHashMap 3.put() method
1.putVal() method
General process of writing data
Pre write operation
1. ConcurrentHashMap does not allow NULL key or value, and an exception will be thrown
2. Before writing data, the hash value of the key will be processed once. spread()
Write data flow
The entire write data is a spin (dead loop) operation.
Case 1: the current tab ...
Posted by PHPThorsten on Thu, 25 Nov 2021 21:48:57 +0100
Java CyclicBarrier and source code explanation
What is a fence
In Java, the fence CyclicBarrier is a synchronization mechanism. The fence enables a group of threads to be blocked when they reach a synchronization point. Until the last thread in the group reaches the synchronization point, all blocked threads will be awakened and continue to execute, that is, the purpose is to continue to e ...
Posted by fooDigi on Wed, 03 Nov 2021 18:20:57 +0100
Advanced part of concurrency (detailed explanation of ThreadLocal, analysis of thread pool source code, comparison of synchronized and lock) summary
Article reference source: javaguide
1.synchronized
1.1 what do you know about synchronized?
Heavyweight lock. The monitor lock is used at the bottomContext switching consumes a lot of time and resources because java threads need to be converted to operating system threads and the transfer from user state to kernel stateAfter jdk1.6, a lar ...
Posted by bob_rock on Wed, 20 Oct 2021 21:37:28 +0200
Thread security issues for JUC collections
scene
Because when working, you don't over-consider the issue of high concurrency. Most collections use normal lists, sets, maps. There's not much problem either. But if you're in a multi-threaded scenario where multiple threads are manipulating a collection at the same time, there's a lot of problem.
Collection Security Issue Code Display
L ...
Posted by SaxMan101 on Fri, 10 Sep 2021 18:13:05 +0200