Introduction to ThreadPoolExecutor & Source Code Analysis

foreword The thread pool is a tool for managing threads based on pooling ideas. As multi-core CPU s become mainstream, multi-threaded parallel processing tasks have gradually become an essential skill for development partners to improve the server's ability to process tasks at work. Introduction to thread pool Benefits of thread pool ...

Posted by adamh91 on Tue, 28 Feb 2023 00:41:45 +0300

How Java creates threads from glibc to kernel thread

How Java creates threads (2) From glibc to kernel thread background In the previous section, we discussed how java threads are created, and looked at what has been done in the source code from the java code level to the jvm level. The whole process is still relatively complicated. I will paste the call timing diagram summarized in the previou ...

Posted by rantsh on Sat, 11 Feb 2023 23:12:18 +0300

[Python] Introduction to Multithreading and Synchronization

Thread is the smallest unit that the operating system can perform operation scheduling; the thread itself does not own system resources, but only has a few resources that are necessary for operation, but it can share the process owned by other threads belonging to the same process. All resources. thread implementation There are two ways o ...

Posted by VLE79E on Tue, 04 Oct 2022 14:22:42 +0300

ReentrantLock lock related methods

catalogue Implementation class of Lock interface ReentrantLock method ReentrantLockTest test Thread for testing t1 test Release the reentry lock correctly Get the current number of reentries t1t2 test Use the islocked() method to detect the lock state t1t3 test Use the trylock method to attempt to acquire a lock U ...

Posted by wxflint on Sun, 04 Sep 2022 22:34:19 +0300

Basic concepts of thread

What is a process? What is a thread Process: simple explanation, an application on the computer hard disk, such as QQ Exe, when it runs, is called a process. Thread: the smallest execution unit in a process is called a thread. Several ways of creating process 1. Inherit the Thread class and override the run() method 2. Implement the Runnable in ...

Posted by lill77 on Wed, 25 May 2022 15:54:58 +0300

The teacher has sent something, you have to queue up to receive it, Java synchronized keyword

When I was a child, when the teacher sent something, he asked us to line up one by one not to grab it, or we would get spanked. This scenario of multiple people queuing up to receive things is very similar to the scenario in which multiple threads access shared resources in programming. Today we combine the Java synchronized keyword to explain. ...

Posted by eastcoastdubs on Tue, 24 May 2022 03:06:35 +0300

Thread class of multithreading series

In the last article Multithreading Foundation , in this article, let's learn the Thread class in C# inside. The Thread class is in net framework1. API introduced in version 0. If you are not clear about the concept of Thread, please read my last article: Multithreading series (I), multithreading Foundation In this article, the method code of st ...

Posted by TAViX on Sun, 22 May 2022 10:09:00 +0300

​JDK1.8 new feature: still writing null pointer check code repeatedly? Use Optional now

1. Foreword As a Java programmer, whether a novice or a veteran expert, he must have encountered all kinds of abnormal errors. In a foreign article, the ranking list of exception types is counted, as shown in the following figure: Yes, you're right. NullPointerException tops the list. Charles Antony Richard Hoare, the inventor of Null Referen ...

Posted by habs20 on Sat, 21 May 2022 10:20:38 +0300

Java multithreading (with exercises and partial parsing)

Java multithreading and parallel programming 1, Basic knowledge points 1. Thread concept (understand) Program: represents a static object. It is a file containing instructions and data, which is stored on disk or other storage devices Process: represents a dynamic object. It is an execution process of a program. It exists in the memory ...

Posted by Lord Sauron on Sat, 21 May 2022 02:19:26 +0300

Java multi-threading ~ implements the singleton mode in two modes: "hungry man" and "lazy man"

content What is the singleton pattern? How to implement the singleton pattern through code? hungry man mode lazy mode Single thread version Multithreaded version double check method What is the singleton pattern? The singleton pattern is a type of design pattern. The singleton pattern means that when a class is provided for use else ...

Posted by mikeatrpi on Fri, 20 May 2022 22:24:49 +0300