Multithreading Foundation

1 process and thread Process: a process is a dynamic execution process of a program. It has experienced a complete process from code loading, execution to execution. This process is also the process of the process itself from generation, development to extinctionProcess: the program being execuUTF-8...

Posted by SirChick on Fri, 28 Jan 2022 08:53:25 +1030

JAVA multithreading - thread insecurity of collection class

ArrayList thread is unsafe case package JUC; import java.util.ArrayList; import java.util.List; import java.util.UUID; /** * @author zhaolimin * @date 2021/11/13 * @apiNote ArrayList Class unsafe test */ public class ArrayListNotSafeDemo { public static void main(String[] args) { List lUTF-8...

Posted by akdrmeb on Fri, 28 Jan 2022 21:44:40 +1030

On thread pool

Class diagram Basic attribute: COUNT_BITS,CAPACITY private static final int COUNT_BITS = Integer.SIZE - 3; private static final int CAPACITY = (1

Posted by TwistedLogix on Tue, 01 Feb 2022 11:14:34 +1030

Analysis of the source code of ConcurrentLinkedQueue

catalogue Applicable scenario Bottom implementation (this article is based on jdk15 source code) Queue is a common data structure. Its main feature is FIFO. Java defines the interface class: queue and provides rich implementations. There are [bounded] queues based on the underlying array, unbouUTF-8...

Posted by davidjwest on Tue, 01 Feb 2022 21:42:36 +1030

Detailed explanation and example demonstration of JUC concurrent programming (Java. Util. Concurrent Toolkit)

JUC concurrent programming Author: pox21s summary In Java, the thread part is a key point. This article is about thread concurrent programming. JUC is Java util . Short for concurrent toolkit. This is a toolkit for processing threads, which has appeared since JDK 1.5. 1. Basic concepts 1.1 procUTF-8...

Posted by iwanpattyn on Thu, 03 Feb 2022 21:36:40 +1030

[JUC concurrent programming 08] JUC powerful auxiliary class

8 JUC powerful auxiliary class This auxiliary class mainly describes three aspects Decrease count CountDownLatch Cyclic barrier Semaphore 8.1 count reduction CountDownLatch The construction method of this class is to construct a CountDownLatch(int count) initialized with a given count, and insUTF-8...

Posted by damisi on Sat, 05 Feb 2022 22:11:23 +1030

Java JUC PriorityBlockingQueue parsing

Unbounded blocking queue PriorityBlockingQueueintroducePriorityBlockingQueue is an unbounded blocking queue with priority. Each time out of the queue, the elements with the highest or lowest priority are returned. Internally, balanced binary tree heap is used, so traversing elements does not guUTF-8...

Posted by mattchewone on Mon, 07 Feb 2022 18:55:16 +1030

A brief analysis of JUC source code AbstractQueuedSynchronizer

Related reading brief introduction AQS is the basic framework class used to build locks or other synchronization components (semaphores, events, etc.); The internal implementation of concurrency tool classes depends on AQS, such as ReentrantLock, Semaphore, CountDownLatch, etc. The main usage iUTF-8...

Posted by atitthaker on Thu, 17 Feb 2022 21:49:41 +1030

AQS source code exploration

aqs At this time, the main function has two threads a and B public class AQSDemo { public static void main(String[] args) { ReentrantLock lock = new ReentrantLock(); new Thread(()->{ lock.lock(); try { System.out.println("-----A thread come in"); TimeUnit.MINUTES.sleep(20); }catch (Exception e)UTF-8...

Posted by Alt_F4 on Sat, 19 Feb 2022 00:15:04 +1030

AQS source code, you can also

You need to have a certain foundation of JUC to watch. AQS source code The diagram roughly describes the process, using state, which is similar to the semaphore operation of the operating system. [the external chain image transfer fails, and the source station may have an anti-theft chain mechaUTF-8...

Posted by Tekron-X on Tue, 22 Feb 2022 20:35:13 +1030