Concurrent programming - the specific implementation of ThreadPoolExecutor
Concurrent programming
Executor thread pool principle and source code analysis
ThreadPoolExecutor default thread pool
Creation of thread pool
public ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
...
Added by syed on Fri, 24 Dec 2021 09:16:20 +0200
Ali was asked about the Java ThreadPool thread pool on both sides. After reading this article, he angered the interviewer
Advantages of thread pool
The work done by the thread pool is mainly to control the number of running threads, put tasks into the queue during processing, and then start these tasks after threads are created. If the number of threads exceeds the maximum number, the exceeded threads queue up, wait for other threads to complete execution, and ...
Added by sectachrome on Thu, 23 Dec 2021 23:05:23 +0200
Java multithreading and concurrent programming | synchronization container & Atomic package & CAS algorithm
preface
In the multithreaded environment, many classes we use everyday have thread safety problems, such as ArrayList, HashSet and HashMap. How should we deal with the thread problem in the multithreaded environment? What is the CAS algorithm? Is there any other way to achieve thread safety other than synchronized? Optimistic lock? Pessimis ...
Added by Stray_Bullet on Sat, 18 Dec 2021 19:19:51 +0200
See how I explained the synchronized lock upgrade process to the interviewer
Prepare for 2022 spring recruitment or summer internship. I wish you a little progress every day! Java Concurrent Programming Day8This article summarizes how to avoid creating unnecessary objects in Java, which will be updated daily~For knowledge points such as "let's learn Redis together" and "let's learn HarmonyOS togeth ...
Added by monotoko on Wed, 08 Dec 2021 02:54:29 +0200
Java Concurrent Programming - JDK concurrency tool for shared model 2: J.U.C
2, J.U.C
1. * AQS principle
1. General
Its full name is AbstractQueuedSynchronizer, which is the framework of blocking locks and related synchronizer tools
characteristic:
The state attribute is used to represent the state of resources (exclusive mode and shared mode). Subclasses need to define how to maintain this state and control how ...
Added by ven0m on Sat, 20 Nov 2021 02:23:19 +0200
November 12 concurrent 7_ Thread pool (structure + template)
1. Thread pool As we all know, a thread is an executing branch of a process On the operating system, scheduling is carried out on a site by site basis => Theoretically, the more threads a process has, the higher its processing efficiency But in fact, it is affected by the operating s ...
Added by r_honey on Wed, 17 Nov 2021 03:36:16 +0200
An article to understand ThreadPoolExecutor
preface
This article belongs to the column "100 problems to solve Java concurrency". This column is original by the author. Please indicate the source of quotation. Please help point out the deficiencies and errors in the comment area. Thank you!
Please refer to table of contents and references for this column 100 problems to sol ...
Added by UQ13A on Tue, 09 Nov 2021 20:45:51 +0200
Executors source code analysis (JDK8)
preface
This article belongs to the column "100 problems to solve Java concurrency". This column is original by the author. Please indicate the source of quotation. Please help point out the deficiencies and errors in the comment area. Thank you!
Please refer to table of contents and references for this column 100 problems to sol ...
Added by kiwi2 on Tue, 09 Nov 2021 02:19:47 +0200
locks of Java Concurrent Programming
Locks are used to control how multiple threads access shared resources. Generally speaking, a Lock can prevent multiple threads from accessing shared resources at the same time (but some locks can allow multiple threads to access shared resources concurrently, such as read-write locks). Before the emergence of the Lock interface, Java progra ...
Added by tylerdurden on Sat, 02 Oct 2021 03:20:15 +0300
ReentrantLock introduction and AQS source code
Lock
Lock is the core tool in J.U.C. its function is the same as synchronized explained earlier. It is also used to solve thread safety problems in multithreaded environment. In the J.U.C package, the lock mechanism is used in many places.
J. The full name of U.C is java.util.concurrent. It is a common toolkit in concurrent programming. Th ...
Added by pixelsoul on Sat, 04 Sep 2021 23:11:06 +0300