Learning notes of C + + standard library - STL - concurrency - start thread

1, Advanced interfaces async() and Future async() provides an interface to make a caller object a separate thread. class future allows you to wait for the thread to end and get its results. 1. Instance Consider the following: func1() + func2() In a single thread, the overall processing time is the time spent by func1() plus the time s ...

Posted on Fri, 03 Dec 2021 15:57:31 -0500 by woza_uk

What does countdown latch do?

The article is short. I haven't explained some top-level methods of AQS, such as releaseShared, because these are the categories of AQS. You can see another article about AQS—— AQS. CountDownLatch is generally referred to as a "counter". Its function is to count until the number reaches a certain point. It can be used ...

Posted on Fri, 03 Dec 2021 13:37:48 -0500 by NJordan72

java basics-multithreading Basics

Parallel and Concurrent Parallel: Multiple CPU instances or machines executing a piece of processing logic at the same time are truly simultaneous. Concurrency: A CPU or a machine, through the CPU scheduling algorithm, makes the user appear to be executing at the same time, actually not at the same time from the CPU operation level. Conc ...

Posted on Sun, 28 Nov 2021 17:28:55 -0500 by nate2687

AQS principle and ReentrantLock source code analysis

The full name of AQS is AbstractQueuedSynchronizer, that is, abstract queue synchronizer. This class is under the java.util.concurrent.locks package. AQS is a framework used to build locks and synchronizers. Using AQS can easily and efficiently construct a large number of synchronizers widely used, such as ReentrantLock and Semaphore, an ...

Posted on Sun, 28 Nov 2021 08:03:28 -0500 by edawg

[high concurrency] deeply analyze the source code of ScheduledThreadPoolExecutor class

original text    https://xie.infoq.cn/article/79486af98d788161e46e3ca9b In the column [high concurrency topics], we deeply analyzed the source code of ThreadPoolExecutor class, and ScheduledThreadPoolExecutor class is a subclass of ThreadPoolExecutor class. Today, let's tear up the source code of the ScheduledThreadPoolExecutor cla ...

Posted on Sun, 28 Nov 2021 06:00:44 -0500 by gc40

Introduction and internal principles of Python's widely used concurrent processing Library futures

When using Python to process tasks, due to the limited processing capacity of a single thread, it is necessary to parallelize the tasks and distribute them to multiple threads or processes for execution. concurrent.futures is such a library, which allows users to easily parallelize tasks. The name is a little long. I directly use the word conc ...

Posted on Thu, 25 Nov 2021 14:32:45 -0500 by AlGale

condition_variable,wait,notify_one,notify_all

catalogue 1, Condition variable std::condition_variable,wait(),notify_one() std:: condition_variable is actually a class, a class related to conditions. To put it bluntly, it is waiting for a condition to be reached. This class needs to work with mutexes. When we use it, we need to generate the object of this class. Example code: Thread A ...

Posted on Fri, 19 Nov 2021 19:09:10 -0500 by xwishmasterx

JUC concurrent toolset: CountDownLatch, Semaphore, CyclicBarrier

CountDownLatch concept The countDownLatch class enables a thread to wait for other threads to execute after their own execution. It is implemented through a counter. The initial value of the counter is the number of threads. Every time a thread is executed, the counter value is - 1. When the counter value is 0, it means that all threads are ...

Posted on Fri, 12 Nov 2021 07:02:42 -0500 by hob_goblin

Teach you to learn Dapr - 5. State management

introduceWith state management, your application can store data as key / value pairs in a supported state store.Your application can use Dapr's State Management API to use the state storage component to save and read key / value pairs, as shown in the following figure. For example, by using HTTP POST, you can save key / value pairs, and by usin ...

Posted on Fri, 12 Nov 2021 02:59:52 -0500 by ac1dsp3ctrum

Concurrent programming ThreadLocal principle analysis and memory leakage

Basic introduction What is ThreadLocal? First, we refer to the source code annotation of ThreadLocal This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one has its own, independently initialized copy of the variable. ThreadLocal instances are typically pri ...

Posted on Thu, 11 Nov 2021 17:16:22 -0500 by PHPNewbie55