Java multithreading combat series notes - Implementation of multithreading

Implementation of multithreading Implementing threads is the basis of concurrent programming, because we must implement threads before we can continue a series of subsequent operations. Basic implementation mode Runable public class ImplementRunable implements Runnable { @Override public void run() { while (true) { ...

Added by ttmt on Tue, 07 Dec 2021 10:25:18 +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

Multithreading and threading source code analysis

What is multithreading Multithreading is the smallest unit that the operating system can schedule. It is included in the process and is the actual operation unit of the process. The number of hardware CPU cores corresponds to the number of threads that can be executed at the same time. Specific evolution path IO database interaction, disk br ...

Added by tomo11 on Tue, 30 Nov 2021 17:32:12 +0200

JUC learning - thread pool 2

Next blog https://blog.csdn.net/qq_43605444/article/details/121568416?spm=1001.2014.3001.5501 8. 4 common saturation strategies When the queue in the thread pool is full and the thread pool has reached the maximum number of threads, the thread pool will pass the task to the saturation policy for processing. These policies implement the Reject ...

Added by QuietWhistler on Sat, 27 Nov 2021 03:57:23 +0200

Java thread pool ThreadPoolExecutor

What is a thread pool In order to avoid frequent thread creation and destruction, we can reuse the created threads.There are always several active threads in the thread pool. When the thread needs to be used, get a free thread. When the work is completed, it is not urgent to turn off the thread, but return the thread to the thread pool for eas ...

Added by The-Last-Escape on Thu, 25 Nov 2021 22:37:35 +0200

JUC learning - ReentrantLock

1, ReentrantLock in JUC 1. Limitations of synchronized Synchronized is a built-in keyword in java, which provides an exclusive locking method. The synchronized acquisition and release locks are implemented by the jvm. Users do not need to display the released locks, which is very convenient. However, synchronized also has some limitations, su ...

Added by demon_athens on Thu, 25 Nov 2021 21:41:52 +0200

The most detailed source code analysis for HashMap and Concurrent HashMap of Java base collection classes

HashMap Source Analysis HashMap is a common key-value collection implementation class in Java that implements the Map interface. data structure Core: The whole is an array;Each position of the array is a chain list (or a red-black tree);The Value in each node of the list is the Object we store; JDK 1.7 data structure Array+Chain List ...

Added by plapeyre on Fri, 19 Nov 2021 19:55:24 +0200

Daily - completable future asynchronous network car Hailing service timed out and was not closed

Project scenario: KC project cooperates with several online car Hailing suppliers to request car Hailing through the API interface provided by the supplier. Due to the cooperation with multiple suppliers, it is required to call multiple suppliers at the same time, but if synchronous car Hailing is adopted, the waiting time will be too long. Th ...

Added by The_Walrus on Fri, 19 Nov 2021 02:53:45 +0200

C# basic tutorial (XII) deep pickling concurrent dictionary

One question Recently, I encountered a problem with CocurrentDictionary. I can't understand it for the time being. Multithreading operation, foreach loop error: the keyword is not in the dictionary. All threads did not delete elements, but only did not add or modify keys. What's more strange is that they looked at the keys array collection whe ...

Added by Eclectic on Thu, 18 Nov 2021 04:58:18 +0200

Elaborate on Java singleton design pattern

What is design pattern? The design pattern is like the chess score in our chess game, with the red side as the head gun and the black side as the horse jump. For some walking methods of red hair, there are some fixed routines when the black side goes down. If you follow the routines, the situation will suffer. Just like you play a game an ...

Added by roopali on Wed, 10 Nov 2021 14:08:55 +0200