An idea of using redis to realize distributed lock
In one work, there was a small accident. The result of a redis write and read method was always different from what was expected. After careful consideration, it was found that because all nodes in the cluster use shared caches and queues, resource competition may occur among nodes in some scenarios, There may be a "thread insecurity probl ...
Added by Fearsoldier on Mon, 31 Jan 2022 13:11:34 +0200
5 minutes to understand - fair lock, unfair lock, reentry lock, spin lock, read-write lock
Fair lock and unfair lock
Fair lock It refers to that multiple threads acquire locks according to the order of applying for locks, and follow the principle of first come, first serve. Its implementation can use queues. Unfair lock The method of multiple threads acquiring locks is not in the order of applying for locks. The thread that ap ...
Added by balloontrader on Mon, 31 Jan 2022 12:53:02 +0200
PHP process and interprocess communication
environment
The process in php is completed in the form of extension. Through these extensions, we can easily complete a series of actions of the process.
pcntl extension: the main process extension, which completes the process creation in the waiting operation. posix extension: complete the general api of posix compatible machine, such as ob ...
Added by tomasd on Sun, 30 Jan 2022 18:11:11 +0200
Fundamentals of Java multithreaded programming (day 18 of Java from self-study to employment)
Java learning record day 18
Since this slag is converted to Java at the front end, the selection of editor is directly used webstorm With the company idea Some of the following knowledge will be learned from the boss Liao Xuefeng's blog
Learning objectives
What is multithreading and how to use it?
Learning content
Java multithreadi ...
Added by Brink Kale on Sun, 30 Jan 2022 15:15:48 +0200
[JAVA core knowledge] 18: thread local variable ThreadLocal
ThreadLocal is jdk1 2, which is used to provide local variables in the thread. Unlike ordinary variables, thread local variables are bound to threads, and each thread has its own independent variable container. Thread local variables play a role in the life cycle of a thread to reduce the transmission complexity of common variables between m ...
Added by shu on Sun, 30 Jan 2022 14:05:07 +0200
Detailed explanation of CountDownLatch principle
introduce
When you read this article, you need to understand the principle of AQS first, because this article does not involve the explanation of the internal principle of AQS.
CountDownLatch is a synchronization assistant. When multiple threads execute tasks, we need to wait for the thread to complete the execution before executing the ...
Added by lasse48 on Sat, 29 Jan 2022 16:25:17 +0200
Source code analysis of AQS (AbstractQueuedSynchronizer)
What is AQS? In Lock, a synchronization queue AQS is used. Its full name is AbstractQueuedSynchronizer. It is a synchronization tool and the core component used by Lock to realize thread synchronization. java. util. Most of the tools in concurrent are implemented through AQS.
The core idea of AQS is that if the requested shared resource is idl ...
Added by tcarnes on Sat, 29 Jan 2022 16:21:22 +0200
Four ways to generate random numbers in Java!
In Java, there are many scenarios for generating random numbers, so in this article, we will take an inventory of the four ways to generate random numbers, the differences between them and the corresponding scenarios of each way.
1.Random
Random class was born in JDK 1.0. The random number it generates is pseudo-random number, that is, regula ...
Added by Cailean on Sat, 29 Jan 2022 14:41:44 +0200
Improvement of Crawler Based on Multithreading
Same series of articles
python crawler + pygal interactive visual crawling University QS ranking_ m0_61168705 blog - CSDN bloghttps://blog.csdn.net/m0_61168705/article/details/122699759?spm=1001.2014.3001.5501
Article catalogue
catalogue
Same series of articles
Article catalogue
preface
1, Imported Libraries
2, Rewrite code ren ...
Added by xcasio on Sat, 29 Jan 2022 00:32:42 +0200
Synchronized & volatile of concurrent programming
Synchronized & volatile of concurrent programming
concept
Locks are often mentioned in concurrent programming. Adding locks ensures the data security of multiple threads. Each object in java can be used as a lock. There are three specific manifestations:
For common synchronization methods, the lock is the current instance object; F ...
Added by Bigdogcms on Fri, 28 Jan 2022 17:15:41 +0200