Tool for java Concurrent Programming sharing model - AQS + ReentrantLock
preface
This article discusses the AQS interface provided in JDK and one of its implementation classes, ReentrantLock. The article is based on the book "the art of Java Concurrent Programming" and the video of dark horse Dark horse multithreading Take notes.
1. AQS
1. Concept
Overview: the full name is AbstractQueuedSynch ...
Added by IronWarrior on Sun, 06 Feb 2022 23:44:45 +0200
Java multithreading -- blocking queue -- use / tutorial / example
Original website:
brief introduction
explain
This article introduces the usage of blocking queue in Java with examples.
Queue type
There are several types of BlockingQueue: ArrayBlockingQueue, LinkedBlockingQueue, synchroousqueue, PriorityBlockingQueue, DelayedWorkQueue.
Queue typeexplainArrayBlockingQueue FIFO queue based on array; Bound ...
Added by sone_br on Sun, 06 Feb 2022 04:25:09 +0200
java socket for communication programming [2] - continuous communication and multithreaded communication
The previous section talked about the simple communication between the server and client of java socket, and learned about the communication mechanism of socket. See the following for details: java socket for communication programming
Today, let's go further. There is a problem in the previous example, that is, sending messages only once ends. ...
Added by feckless on Sat, 05 Feb 2022 20:49:22 +0200
Detailed explanation and application of [005] [RT-Thread learning notes] semaphore
RT-Thread version: 4.0.5 MCU model: STM32F103RCT6 (ARM Cortex-M3 kernel)
1 Synchronization and Mutual Exclusion
First add a few concepts:
Execution Unit: Determined by the current hardware platform and the operating system it runs. For RT-Thread and STM32, the execution units are threads and interruptsCritical Zone: Multiple execut ...
Added by mcollyns on Sat, 05 Feb 2022 20:24:58 +0200
Linux multithreaded programming
Create and end threads
pthread_create
#include <pthread.h>
/* Create a new thread, starting with execution of START-ROUTINE
getting passed ARG. Creation attributed come from ATTR. The new
handle is stored in *NEWTHREAD. */
extern int pthread_create (pthread_t *__restrict __newthread,
const pthread_attr_t *__restrict __at ...
Added by benreisner on Thu, 03 Feb 2022 20:09:46 +0200
Chapter 3 - management of shared model
Chapter 3 - management of shared model (4)
Thread state
Re understand thread state transition (key)
Suppose there is a thread Thread t
Case 1 new -- > runnable
When the t.start() method is called, new -- > runable
Case 2 runnable < – > waiting
After the t thread obtains the object lock with synchronized(obj)C ...
Added by tave on Thu, 03 Feb 2022 12:19:48 +0200
Java Concurrent Programming - the source of concurrency problems
Threads and processes
Process
It is a running activity of the program in the computer on a certain data set. It is the basic unit of resource allocation and scheduling of the system and the basis of the structure of the operating system.
(process understanding: an independent area on the operating system. Each process runs independently ...
Added by clarencek on Thu, 03 Feb 2022 08:12:51 +0200
5 minutes to understand - Async, the asynchronous framework of SpringBoot
Asynchronous framework
Why use asynchronous framework? Solve what problem?
In the development of spring boot, it is generally called synchronously. However, there are often special businesses that need to be processed asynchronously. For example: register a new user, send 100 points, or place a successful order, send a push message, etc. ...
Added by cx323 on Thu, 03 Feb 2022 04:36:02 +0200
JUC study notes
Shangsi Valley JUC source code teaching practical tutorial complete version (java juc thread intensive lecture)
1.volatile keyword and memory visibility
When the program runs, the JVM will allocate an independent cache for each thread executing tasks to improve efficiency.
The memory visibility problem is that when multiple threads operate t ...
Added by Minor Threat on Thu, 03 Feb 2022 00:08:56 +0200
Guys, don't be silly to distinguish the thread life cycle and thread pool life cycle!!!
Thread life cycle
Source code proof
Calling thread getState method: Thread.currentThread().getState();
public State getState() {
// get current thread state
return sun.misc.VM.toThreadState(threadStatus);
}
public static State toThreadState(int var0) {
if ((var0 & 4) != 0) {
r ...
Added by minou on Wed, 02 Feb 2022 20:04:56 +0200