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.
There are two ways o ...
Posted by VLE79E on Tue, 04 Oct 2022 14:22:42 +0300
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
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
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
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
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 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
What is the singleton pattern?
How to implement the singleton pattern through code?
hungry man mode
Single thread 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
When reading and writing data globally, if atomic operations cannot be guaranteed, it is easy to pollute the data.
from threading import Lock
l = 
num = l
l = num + 1
threads = 
if __name__ == '__main__':
for i in range(100):
Posted by Wynder on Thu, 19 May 2022 05:28:58 +0300
Design mode - single case mode - eight different implementations [JAVA] and single case problem sorting - necessary for interview - super detailed
Introduction to singleton mode
the singleton pattern is a software design pattern that restricts the instantiation of a class to one "single" instance. It can be simply understood as: a class ca ...
Posted by SalokinX on Mon, 16 May 2022 21:13:29 +0300