JUC high concurrency programming
12. Fork/Join branch merge framework
1. Introduction
Fork/Join can split a large task into multiple subtasks for parallel processing, and finally merge the subtask results into the final calculation results for output. The Fork/Join framework does two things Fork: Split a complex task and make it small
Join: Merge the split task calculation ...
Posted by Zhadus on Sun, 05 Dec 2021 17:12:08 +0100
The Rust Programming Language - Chapter 16 fearless concurrency - 16.2 passing data between processes using messaging
16 fearless concurrent
Safe and efficient handling of concurrent programming is another major goal of Rust
Memory security and efficient programming have always been the goal of many languages. Rust uses ownership and type system to balance this
In this chapter, we will understand
1. How to create threads to run multi terminal code at the s ...
Posted by AbsolutelyFreeW on Sun, 28 Nov 2021 16:40:31 +0100
Breakdown thread pool test questions: 3 methods, 7 parameters and 4 rejection strategies
Multithreading knowledge is a must in Java interview. This article introduces thread pool in detail. In the actual development process, many IT practitioners have a low utilization rate. They just understand a theoretical knowledge and recite various eight part essays, but they don't deeply understand them in their mind, resulting in forgetting ...
Posted by WakeAngel on Thu, 25 Nov 2021 04:58:20 +0100
Multithreaded server programming [2] - Essentials of thread synchronization
Four principles of thread synchronizationMinimum sharing of objects, reducing the need for synchronizationUse advanced concurrency components, such as TaskQueue, producer consumer queue, CountDownLatch, etcWhen you have to use the underlying synchronization primitive, only use non recursive mutexes and conditional variables. Use read-write lock ...
Posted by metuin on Tue, 23 Nov 2021 06:26:00 +0100
Threadlocal for strong and weak references
Start with SimpleDateFormat
Let's first look at an example. When 20 threads are created, one thing is done in the thread, that is, the conversion time
public class ThreadLoaclExample {
//Non thread safe
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Date parse(String strDat ...
Posted by ashly on Mon, 22 Nov 2021 00:39:25 +0100
Balking mode of concurrent programming: on the singleton mode of thread safety
introduction
The previous article mentioned that the "multi-threaded version of if" can be used to understand the Guarded Suspension mode, which is different from the if in a single thread. This "multi-threaded version of if" needs to wait and is very persistent. You must wait until the condition is true. But obviously, ...
Posted by blakey on Sun, 21 Nov 2021 05:53:18 +0100
Java CyclicBarrier and source code explanation
What is a fence
In Java, the fence CyclicBarrier is a synchronization mechanism. The fence enables a group of threads to be blocked when they reach a synchronization point. Until the last thread in the group reaches the synchronization point, all blocked threads will be awakened and continue to execute, that is, the purpose is to continue to e ...
Posted by fooDigi on Wed, 03 Nov 2021 18:20:57 +0100
Concurrent programming - Condition implementation of blocking queue and source code analysis
preface
In the last article, we used wait & notify Implement blocking queue Implemented a blocking queue. Today, let's see how to use the Condition object of ReentrantLock to implement the blocking queue
practice
public static void main(String[] args) {
ConditionQueue conditionQueue = new ConditionQueue(5);
for (int i ...
Posted by mordeith on Mon, 01 Nov 2021 13:09:18 +0100
Deeply understand the lock free CAS mechanism, magic class Unsafe and Atomic package Atomic of Java Concurrent Programming
introduction
In fact, when we explained the principle of synchronized keyword in Java Concurrent Programming in our last article, we talked about the concept of CAS many times, so what is it? In fact, in order to solve the thread safety problems caused by multi-threaded parallel execution, we often use the locking mechanism to change multi-thr ...
Posted by everknown on Wed, 20 Oct 2021 23:35:24 +0200
ABA problem and solution under concurrent programming CAS
Catalogue of series articles
1: Computer model & detailed explanation of volatile keyword 2: Lock system in java 3: synchronized keyword explanation 5: Atomic atomic class and Unsafe magic class 6: ABA problems and solutions under CAS
1, CAS problem introduction
In the concurrency problem, the first thought is undoubtedly ...
Posted by buraks78 on Tue, 19 Oct 2021 02:26:47 +0200