Lock free concurrency of JUC (leguan lock)

1. Quote There are the following requirements to ensure account Thread safety of withdraw withdrawal method interface Account { /** * Get balance * * @return Integer balance */ Integer getBalance(); /** * withdraw money * * @param amount Withdrawal amount */ void withdraw(Integ ...

Added by volomike on Sun, 13 Feb 2022 14:10:52 +0200

AQS detailed explanation and source code annotation analysis

AQS detailed explanation and source code analysis 1. General What is AQS? The full name is AbstractQueuedSynchronizer, which is an abstract class in JDK. First, let's look at the classes that inherit it: Basically, all classes in JUC concurrent packages are related to it. AQS is a heavyweight basic framework used to build locks or other sy ...

Added by Hypnos on Wed, 09 Feb 2022 06:30:36 +0200

JUC - ArrayList and LinkedList summary

1, Overview ​​ 1. Inheritance structure of collection As can be seen from the above figure, there are two interfaces list and set under the Collection. List represents the linear table in the data structure, and the implementation method of linear table is divided into linked list and array. Set means set. Each element in a set is indep ...

Added by obewan on Tue, 08 Feb 2022 11:29:18 +0200

JUC Note-Sharing Model Invariant

1. Design of Invariant Classes Invariant: An object is an immutable object if it cannot modify its internal state (properties) Thread-safe, concurrent modification and visibility issues for immutable objects are another way to avoid competition String classes are also immutable, and all attributes within the class are final The final ...

Added by daniel_lee_hill on Mon, 07 Feb 2022 19:18:10 +0200

Java knowledge needed for work (JUC Lock Learning Paper)

JUC is a part of my job that I don't use very much, but I often get asked about it in a helpless interview, so I'll learn about JUC today. JUC is all called Java. Util. The concurrent package is a toolkit for Java, so why is JUC a frequent question for interviews? Because JUC includes multithreading, atomicity, locks and other heavy content, i ...

Added by UQ13A on Sat, 05 Feb 2022 19:04:49 +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

Chapter 3 - management of shared model

Chapter 3 - management of shared model (1) Contents of this chapter Sharing problemsynchronizedThread safety analysisMonitorwait/notifyThread state transitionActivityLock Problems caused by sharing Little story Lao Wang (operating system) has a powerful abacus (CPU). Now he wants to rent it and earn some extra money Xiao Nan and Xia ...

Added by morphboy23 on Tue, 01 Feb 2022 10:02:58 +0200

JUC study notes

1. What is JUC? java.util Toolkit 2. Process and thread Process and thread Process: the execution process of a program. It is a running activity of the program on a data set in the computer. It is the basic unit for resource allocation and scheduling of the system and the basis of the structure of the operating system. Narrow definit ...

Added by Arrow on Sun, 30 Jan 2022 00:05:35 +0200

ReentrantLock in JUC from Java thread to kotlin coroutine

Previous: From Java thread to kotlin coroutine util. concurrent. Interfaces and implementation classes in locks package ReentrantLock The re-entry Lock can be locked many times, and the Lock interface is implemented Unlike synchronized, synchronized locks and unlocks automatically, while the implementation class of Lock interface needs to Lo ...

Added by H4mm3r3r on Sat, 29 Jan 2022 15:11:47 +0200

Java JUC concurrent linkedqueue parsing

Research on the principle of concurrent linkedqueueintroduceConcurrentLinkedQueue is a thread safe unbounded non blocking queue. The bottom layer uses one-way linked list to achieve thread safety. CAS is used for incoming and outgoing operations.The internal queue of ConcurrentLinkedQueue is implemented in the way of one-way linked list, in whi ...

Added by ben2k8 on Thu, 27 Jan 2022 12:23:55 +0200