I understand AQS thoroughly. How about you?
background
I wrote an article on understanding AQS in depth earlier
Thoroughly understand AQS
After a period of time, I found that I couldn't remember some places clearly, and what I had written before was not good, so I didn't feel that I understood them thoroughly, so I decided to look for information again and thoroughly understand what I ...
Posted by Red Blaze on Wed, 03 Nov 2021 01:25:18 -0700
Java thread API, article summary
Thread creation
Inherit Thread class
You can create a Thread by inheriting the Thread class and creating an object through new.
public class MyThread extends Thread {
private int count = 5;
@Override
synchronized public void run() {
super.run();
count--;
System.out.println("from " + this.curre ...
Posted by stevel on Sun, 31 Oct 2021 02:38:49 -0700
Defects and solutions of CAS
1, ABA problem
ABA problem means that in a concurrent environment, assuming that the initial condition is a, when modifying data, it will be modified if it is found to be a. However, although we see a, there may be a change from a to B and B back to a. This a is not that A. even if the data is successfully modified, there may be problems
Solu ...
Posted by ashok_bam on Thu, 28 Oct 2021 09:18:38 -0700
Java notes - multithreading
Process and thread
Process: The running program is an independent unit for the system to allocate and call resources. Each process has its own memory space and system resourcesThread: It is a single sequential control flow in a process, or a separate execution path If a process has only one execution path, it is called a single threaded progra ...
Posted by hagman on Fri, 22 Oct 2021 07:43:32 -0700
Multithreading - lock active
1. Deadlock
Scenario: when thread a owns the lock of object a, it wants to obtain the lock of object B; Thread B owns the lock of object B and wants to own the lock of object A. when two threads acquire the lock, they will not release the lock already held. Therefore, deadlock is caused.
Example code:
@Slf4j
public class ThreadTest {
pri ...
Posted by gruzaw on Wed, 20 Oct 2021 17:39:03 -0700
Predecessors planted trees and posterity enjoyed the cool: Java multithreading in simple terms
1. Thread overview
1.1 threads and processes
Process is a program in the running process and has certain independent functionsConcurrency: only one instruction can be executed at a time, but multiple process instructions are executed in rapid rotationParallelism: multiple instructions are executed simultaneously on multiple processorsA thread ...
Posted by CBG on Tue, 19 Oct 2021 20:13:33 -0700
IntentService for Android multithreading
####What is IntentService?
IntentService inherits from Service, so IntentService is also one of the four major components. IntentService encapsulates the HandlerThread thread thread (only one thread) to process asynchronous tasks in sequence. Start IntentService through startService(Intent) and transmit asynchronous tasks through Intent. When ...
Posted by dotti on Fri, 15 Oct 2021 12:45:38 -0700
Java thread pool for Java Concurrent Programming
Java thread pool:
Core configuration parameters of thread pool: //The timeout of a thread waiting for a task. It takes effect when the number of threads in the thread pool exceeds the corePoolSize. When the thread waiting for a task exceeds keepAliveTime, the thread pool will stop threads that exceed the corePoolSize.
private volatile long ke ...
Posted by larsojl on Thu, 14 Oct 2021 14:53:55 -0700
JUC series | ThreadPool thread pool
Multithreading has always been a difficulty in Java development and a frequent visitor in the interview. While there is still time, I intend to consolidate my knowledge of JUC. I think opportunities can be seen everywhere, but they are always reserved for those who are prepared. I hope we can all refuel!!!
Sink and float up. I think we will b ...
Posted by AbraCadaver on Wed, 13 Oct 2021 16:54:45 -0700
Crazy God said | JUC Concurrent Programming Notes + their own understanding and sorting
JUC concurrency
1. What is JUC
JUC is the toolkit, package and classification under java.util.
Business: common thread code
ThreadRunnable has no return value, and its efficiency is relatively lower than that of CallableCallable has a return value!
2. Threads and processes
Threads, processes, if you can not use a word out tec ...
Posted by hoffmeister on Tue, 12 Oct 2021 12:18:28 -0700