当前位置:网站首页>你对“happen-before原则”的理解可能是错的?
你对“happen-before原则”的理解可能是错的?
2022-07-26 04:57:00 【知识浅谈】
只是简单理解,如有不足之处,还请指出。
happen-before简单理解
happen-before 规则一共就八条,整理一下对这八条规则的理解。
- 单线程happen-before原则
理解:就是在单线程的程序中,前边代码产生的结果对后边代码是可见的。
- 锁的happen-before原则:
解锁操作的结果对后面的加锁操作一定是可见的,无论两个是否在一个线程。
- volatile的happen-before原则
对 volatile 变量的写操作的结果对于发生于其后的任何操作的结果都是可见的。
- happen-before的传递性原则
A happen-before B ,B happen-before C,则A happen-before C,就是 happen-before 具有传递性
- 线程启动的happen-before原则
start 方法造成的函数副作用必须对其它方法可见。
- 线程中断的happen-before原则
interrupt 方法改变的状态必须对后续执行的检测方法可见。
- 线程终结的happen-before原则
线程中的方法造成的函数副作用必须对线程关闭方法可见。
- 对象创建的happen-before原则
该条原则强调的是多线程情况下对象初始化的结果必须对发生于其后的对象销毁方法可见.
总结:前边程序产生的结果对后边的程序是可见的,但是这个英语总是让你想成谁先与谁发生,只要记住和这个没关系,就记住 前边程序产生的结果对后边的程序是可见的就行了。
边栏推荐
- Google Emoji guessing game helps parents guide their children to surf the Internet safely
- 2022 Hangdian multi school DOS card (line segment tree)
- 数据库启动报:ORA-29702: error occurred in Cluster Group Service
- [semantic segmentation] 2018-deeplabv3+ ECCV
- The first open source MySQL native HTAP database in China will be released soon! Look at the three highlights first, limited to the surrounding areas, waiting for you~
- 【语义分割】2018-DeeplabV3+ ECCV
- Leetcode - monotone stack and monotone queue
- ES6模块化+CommonJS
- 2022杭电多校 DOS Card(线段树)
- Bsdiff and bspatch incremental updates
猜你喜欢

columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by mysql8.0解决办法

minipcie接口CAN卡解决工控机扩展CAN通道的难题 minipcie CAN

What is the real HTAP? (1) Background article

创建MySQL数据库的两种方式
![[semantic segmentation] 2018-deeplabv3+ ECCV](/img/c9/d1e2d7e63df8db2a7fa2bde31b10f7.png)
[semantic segmentation] 2018-deeplabv3+ ECCV

阿里云工业视觉智能工程师ACP认证——备考

滑动窗口——leetcode题解

擅长C(暑假每日一题 6)

UE4 two ways to obtain player control

The landing of tdengine in the GPS and AIS scheduling of Zhongtian steel
随机推荐
Switch to router technology: OSPF single zone configuration, OSPF multi zone and end zone
一个sql server查询截止某个日期最新的记录
Phaser(一):平台跳跃收集游戏
STM32 development | ad7606 parallel multi-channel data acquisition
Solve the error string value: '\xf0\x9f\x98\xad',... 'for column' commentcontent 'at row 1
"Game engine light in light out" 4. shader
Recursive implementation of exponential enumeration
UE4 keyboard control switch light
滑动窗口——leetcode题解
AXI协议(5):AXI协议的burst机制
C language -- string function, memory function collection and Simulation Implementation
[mathematical modeling] analytic hierarchy process (AHP)
二、国际知名项目-HelloWorld
九、文件上传和下载
What are the well-known to-do apps at home and abroad
【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(八)
clock_ gettime
minipcie接口CAN卡解决工控机扩展CAN通道的难题 minipcie CAN
The first open source MySQL native HTAP database in China will be released soon! Look at the three highlights first, limited to the surrounding areas, waiting for you~
5、 Domain objects share data