Java - JUC high concurrency programming, interview must ask (thread safety of collection)

4 thread safety of collections 4.1 set operation Demo (demonstration) NotSafeDemo: import java.util.ArrayList; import java.util.List; import java.util.UUID; /*** Collection thread safety case */ public class NotSafeDemo { /** * Multiple threads modify the collection at the same time */ public static void main(String[] args) { L ...

Posted by IsmAvatar on Wed, 20 Oct 2021 23:08:42 -0700

Java thread pool for Java Concurrent Programming

Java thread pool: Core configuration parameters of thread pool: //The timeout of a thread waiting for a task. It takes effect when the number of threads in the thread pool exceeds the corePoolSize. When the thread waiting for a task exceeds keepAliveTime, the thread pool will stop threads that exceed the corePoolSize. private volatile long ke ...

Posted by larsojl on Thu, 14 Oct 2021 14:53:55 -0700

JUC series | ThreadPool thread pool

Multithreading has always been a difficulty in Java development and a frequent visitor in the interview. While there is still time, I intend to consolidate my knowledge of JUC. I think opportunities can be seen everywhere, but they are always reserved for those who are prepared. I hope we can all refuel!!! Sink and float up. I think we will b ...

Posted by AbraCadaver on Wed, 13 Oct 2021 16:54:45 -0700

Java Concurrent Programming

Note source: Dark horse programmers have a comprehensive and in-depth study of Java Concurrent Programming and a full set of tutorials of JUC concurrent programming Note source: AC_Jobim JUC concurrent programming tutorial Some personal opinions are attached. If there are mistakes, please correct them! 1, ThreadLocal details Good b ...

Posted by phpvn.org on Wed, 13 Oct 2021 12:56:32 -0700

Crazy God said | JUC Concurrent Programming Notes + their own understanding and sorting

JUC concurrency 1. What is JUC JUC is the toolkit, package and classification under java.util. Business: common thread code ThreadRunnable has no return value, and its efficiency is relatively lower than that of CallableCallable has a return value! 2. Threads and processes Threads, processes, if you can not use a word out tec ...

Posted by hoffmeister on Tue, 12 Oct 2021 12:18:28 -0700

What is JUC(JUC overview)

What is JUC Introduction to JUC In Java, the thread part is a key point. The JUC mentioned in this article is also about threads. JUC is the abbreviation of java.util.concurrent toolkit. This is a toolkit for processing threads, which began to appear in JDK1.5 Processes and threads A process is an operation or movement of a computer program ...

Posted by toxic_brain on Tue, 05 Oct 2021 12:56:43 -0700

JUC high concurrency programming

JUC overview 1.1 introduction to JUC java.util.concurrent package is an API for concurrent programmingThere are three packages related to JUC: java.util.concurrent, java.util.concurrent.atomic, and java.util.concurrent.locks 1.2 processes and threads Process: a running application in the system; A program is a process; The smallest unit of ...

Posted by Imothep on Tue, 05 Oct 2021 10:17:01 -0700

[source code analysis] reentrant lock analysis AQS of reentrant lock

ReentrantLock SynchronizedReentrantLockLock implementation mechanismObject header monitor modeRely on AQSflexibilityInflexibleSupport response interrupt, timeout and attempt to acquire lockRelease lock formAutomatic release lockShow call unlock()Support lock typeUnfair lockFair lock & unfair lockConditional queueSingle condition queueMulti ...

Posted by sweenyman on Sun, 03 Oct 2021 20:21:47 -0700

Thread pool ThreadPoolExecutor summary

Thread pool ThreadPoolExecutor What is it: Workers' sweatshopWhat's the use: reduce resource consumption and facilitate thread managementHow to play: play with your new thread pool Thread pool principle Working principle of thread pool (advantages and disadvantages) When there is no thread pool, compare it with the wired process pool. It so ...

Posted by t_machine on Fri, 01 Oct 2021 17:50:40 -0700

JUC whole problem analysis + self summary

catalogue 1, What is JUC?   2, Processes and threads? 3, Locks package   ① The traditional synchronized lock keyword. Sync code block:   Synchronization method:   ② Lock lock 4, Consumer producer issues. 5, 8 lock phenomenon. 6, Collection class unsafe ① List (ArrayList) is not safe ② Set (hashSet) is not secure ...

Posted by jdnet on Wed, 29 Sep 2021 15:50:33 -0700