Synchronized & volatile of concurrent programming
Synchronized & volatile of concurrent programming
concept
Locks are often mentioned in concurrent programming. Adding locks ensures the data security of multiple threads. Each object in java can be used as a lock. There are three specific manifestations:
For common synchronization methods, the lock is the current instance object; F ...
Added by Bigdogcms on Fri, 28 Jan 2022 17:15:41 +0200
One year's work experience, I was asked about CAS
Wedge
In the previous article, we introduced synchronized and learned that synchronized can solve the atomicity problem of some data. In this article, we continue to learn the knowledge of CAS non locking with AtomicInteger as the starting point.
Using synchronized to solve the atomicity of i + +
Use the synchronized keyword to ensure data a ...
Added by twopeak on Thu, 27 Jan 2022 16:48:20 +0200
NioServerSocketChannel registration source code analysis
In the previous chapter, we analyzed the creation and initialization of NioServerSocketChaennl in Netty. In this chapter, we will continue to analyze the analysis of NioServerSocketChannel. NioServerSocketChannel is a channel object officially encapsulated by Netty, which is intended to replace or package the native SocketChannel object of JDK, ...
Added by punk3d on Wed, 26 Jan 2022 19:32:31 +0200
CAS operation and underlying implementation of JUC concurrent programming
concept
The full name of CAS is Compare And Swap, which means compare and exchange. It is the atomic operation of CPUCAS is an abstract idea, not a concrete implementationCAS operation has three parameters: memory address of the value to be modified, expected value and new valueThe main idea is to judge whether the value of a location in memor ...
Added by crash58 on Wed, 26 Jan 2022 06:06:35 +0200
Limit flow for three devices in high concurrency systems
Catalog
1. Three devices for high concurrency systems
2. Current Limiting Algorithms
2.1 Fixed Window algorithm
2.2 Sliding Window algorithm
2.3 Leaky Bucket algorithm
2.4 Token Bucket algorithm
Comparison of 2.5 Leakage Bucket and Token Bucket Algorithms
3. Scenarios for application of current-limiting algorithms
3.1 Google Guava
3 ...
Added by niall_buckley on Mon, 24 Jan 2022 20:17:45 +0200
Promise control concurrency in 5 minutes
causeThe project needs to do an upload function, which uploads 20 videos at a time. There will be a blocking problem if it is not transmitted directly.Because a web page can only have 6 tcp connections with the same domain name at most. If you do not control the concurrent transmission of 6 interfaces at the same time, all subsequent operations ...
Added by jaiswal on Mon, 24 Jan 2022 16:34:53 +0200
Java JUC ReentrantLock parsing
Exclusive lock ReentrantLock principleintroduceReentrantLock is a reentrant exclusive lock. At the same time, only one thread can acquire the lock. Other threads acquiring the lock will be blocked and put into the AQS blocking queue of the lock.It has the same basic behavior and semantics as synchronized, but ReentrantLock is more flexible and ...
Added by isedeasy on Mon, 24 Jan 2022 07:53:41 +0200
The cornerstone of concurrent programming understood by Tencent Architects -- the working principle of Thread class
1. Opening remarks
When it comes to concurrent programming, the first impression in your mind may be Thread, multithreading, JUC, Thread pool, ThreadLocal and so on. Indeed, concurrent programming is an indispensable part of Java programming. Mastering the core technology of concurrent programming will be a sharp weapon in job interviews. Toda ...
Added by evildobbi on Sun, 23 Jan 2022 03:53:55 +0200
[Java notes] the principle and use of ForkJoinPool in java thread pool
This article refers to your Batman, the author of CSDN Usage and principle of ForkJoinPool thread pool He Zhihu author Readily Articles Use and precautions of Fork/Join framework with high concurrency.
ForkJoinPool is mainly used to implement the divide and conquer algorithm, especially the recursive functions called after divide and conque ...
Added by deeppak on Sun, 23 Jan 2022 02:55:21 +0200
Go language Bible - Chapter 9 concurrency based on shared variables - 9.7 example: concurrent non blocking cache
Chapter 9 concurrency based on shared variables
In the previous chapter, we used direct and natural methods such as goroutine and channel to implement concurrency. Sometimes they have some problems
In this chapter, we will introduce the concurrency mechanism in more detail, especially the sharing of variables between goroutines. We will also ...
Added by ManOnScooter on Sat, 22 Jan 2022 11:09:47 +0200