当前位置:网站首页>并发编程之AQS
并发编程之AQS
2022-07-25 13:10:00 【紫乾2014】
一、待定
AQS,全称是 AbstractQueuedSynchronizer,中文译为抽象队列式同步器。这个抽象类对于JUC并发包非常重要,JUC包中的ReentrantLock,,Semaphore,ReentrantReadWriteLock,CountDownLatch 等等几乎所有的类都是基于AQS实现的。
AQS 中有两个重要的东西,一个以Node为节点实现的链表的队列(CHL队列),还有一个STATE标志,并且通过CAS来改变它的值。
CLH队列:
链表结构,在头尾结点中,需要特别指出的是头结点是一个空对象结点,无任何意义,即傀儡结点;
每一个Node结点都维护了一个指向前驱的指针和指向后驱的指针,结点与结点之间相互关联构成链表;
入队在尾,出队在头,出队后需要激活该出队结点的后继结点,若后继结点为空或后继结点waitStatus>0,则从队尾向前遍历取waitStatus<0的触发阻塞唤醒;
队列中节点状态值(waitStatus,只能为以下值)
边栏推荐
- pytorch创建自己的Dataset加载数据集
- Shell常用脚本:判断远程主机的文件是否存在
- 【视频】马尔可夫链原理可视化解释与R语言区制转换MRS实例|数据分享
- Atcoder beginer contest 261e / / bitwise thinking + DP
- Migrate PaloAlto ha high availability firewall to panorama
- Emqx cloud update: more parameters are added to log analysis, which makes monitoring, operation and maintenance easier
- 好友让我看这段代码
- Design and principle of thread pool
- AtCoder Beginner Contest 261E // 按位思考 + dp
- G027-OP-INS-RHEL-04 RedHat OpenStack 创建自定义的QCOW2格式镜像
猜你喜欢

Make a general cascade dictionary selection control based on jeecg -dictcascadeuniversal

ThreadLocal&Fork/Join

深度学习的训练、预测过程详解【以LeNet模型和CIFAR10数据集为例】

工业互联网的内涵及其应用

vim基础操作汇总

Zero basic learning canoe panel (16) -- clock control/panel control/start stop control/tab control

Masscode is an excellent open source code fragment manager
详解浮点数的精度问题

Atcoder beginer contest 261 f / / tree array

Eccv2022 | transclassp class level grab posture migration
随机推荐
Summary of Niuke forum project deployment
Make a general cascade dictionary selection control based on jeecg -dictcascadeuniversal
massCode 一款优秀的开源代码片段管理器
B树和B+树
Zero basic learning canoe panel (16) -- clock control/panel control/start stop control/tab control
卷积神经网络模型之——AlexNet网络结构与代码实现
Blindly expanding the scale of the meta universe has deviated from the development logic of the meta universe
R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
Design and principle of thread pool
Any time, any place, super detective, seriously handle the case!
【OpenCV 例程 300篇】239. Harris 角点检测之精确定位(cornerSubPix)
MySQL remote connection permission error 1045 problem
详解浮点数的精度问题
并发编程 — 内存模型 JMM
程序的内存布局
我的创作纪念日
[CSDN year-end summary] end and start, always on the way - "2021 summary of" 1+1= Wang "
[operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
Zero basic learning canoe panel (12) -- progress bar
牛客论坛项目部署总结