The art of multiprocessor programming - 3. Spin lock and contention

This series is the reading notes of the art of multiprocessor programming. It is understood and implemented on the basis of the original book and combined with the code of OpenJDK 11 or above. And share some personal information with those who want to have a deeper understanding according to their personal data search and understanding experien ...

Posted by zypher11 on Fri, 05 Nov 2021 20:54:01 -0700

Concurrent programming multi process programming (python version)

catalogue 1 overview of Python multiprocess programming 2 needs and programmes Background: Requirements: Solution: Problems and solutions to be solved: 3 complete code 1 overview of Python multiprocess programming Multithreading in Python cannot take advantage of multi-core. If you want to make full use of the resources of multi-core ...

Posted by guzman-el-bueno on Thu, 28 Oct 2021 03:53:37 -0700

Java Concurrent Programming JUC: CyclicBarrier thread synchronization

java.util.concurrent.CyclicBarrier provides a synchronization mechanism for multiple threads to wait for each other. It can be understood as an obstacle. All threads that reach the obstacle first will be in a waiting state. All threads can continue to execute until all threads reach the obstacle. For example, the synchronization mode of Cyc ...

Posted by farkewie on Wed, 27 Oct 2021 08:52:27 -0700

ThreadLocal source code analysis

ThreadLocal principle 1, Introduction to ThreadLocal ThreadLocal can realize that each thread has its own copy of local variables, and different threads will not interfere with each other. It mainly solves the problem of allowing each thread to bind its own value. By using the get() and set() methods, it can obtain the default value or change ...

Posted by rubbertoad on Mon, 25 Oct 2021 23:39:38 -0700

Synchronization lock for concurrent programming

Synchronization lock for concurrent programming 1 thread security The problem is that when multiple threads operate on the same data, we often can't get the expected results. What's the reason for this problem? In fact, the data is not visible to multiple threads. These threads cannot operate the public data in an orderly manner. The operatio ...

Posted by step on Sun, 24 Oct 2021 05:49:34 -0700

Want to thoroughly understand how large manufacturers achieve Redis high availability? Just read this article! (1.2W, recommended Collection)

High Availability HA (High Availability) is one of the factors that must be considered in the architecture design of distributed systems. It usually refers to reducing the time when the system cannot provide services through design. Assuming that the system can always provide services, we say that the availability of the system is 100%. If the ...

Posted by double-f on Fri, 22 Oct 2021 18:03:56 -0700

java high concurrency current limiting solution

High concurrency current limiting solution current limiting algorithm (token bucket, leaky bucket, counter), application layer current limiting (Nginx) Current limiting algorithm Common current limiting algorithms include token bucket and leaky bucket. The counter can also be implemented by current limiting. Counter    It is the s ...

Posted by Kudose on Thu, 21 Oct 2021 10:14:04 -0700

(10) Future other member functions, shared_future,atomic

Section 9. async, future, packaged_task,promise This section needs to include header files #include < future > 1, std::async and std::future create background tasks and return values std::async is a function template used to start an asynchronous task. After starting an asynchronous task, it returns an std::future object, which is a c ...

Posted by jimdidr on Sat, 16 Oct 2021 21:54:53 -0700

Single case design pattern, shared data analysis and solution, call_once

Section 7 single case design pattern, shared data analysis, solution, call_once 1. Design mode The program is flexible and easy to maintain. The code written with the concept of design pattern is very obscure, but it will be painful for others to take over and read the codeWhen foreigners deal with particularly large projects, they summariz ...

Posted by big.nerd on Sat, 16 Oct 2021 21:31:28 -0700

Concurrent programming - detailed analysis of ReentrantLock lock unlock source code

AQS When we construct a ReentrantLock object, we can specify a fair lock or an unfair lock by passing in a Boolean value. After entering the source code, we can find that new has different sync objects public ReentrantLock(boolean fair) { sync = fair ? new FairSync() : new NonfairSync(); } Click on the source code of FairSyn ...

Posted by [L3]sPARTAN on Thu, 14 Oct 2021 14:16:30 -0700