当前位置:网站首页>你对“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原则
该条原则强调的是多线程情况下对象初始化的结果必须对发生于其后的对象销毁方法可见.
总结:前边程序产生的结果对后边的程序是可见的,但是这个英语总是让你想成谁先与谁发生,只要记住和这个没关系,就记住 前边程序产生的结果对后边的程序是可见的就行了。
边栏推荐
- Briefly describe the application fields of WMS warehouse management system
- NFT的几种发行方式你都了解过吗?不同的发行方式有什么优缺点?
- Recognized again | saining network security has been listed in the ccsip 2022 panorama of China's network security industry
- SQL encryption and decryption injection details
- Is this my vs not connected to the database
- Codeforces Round #807 (Div. 2)
- [mathematical modeling] basic knowledge of MATLAB
- 滑动窗口——leetcode题解
- Database startup message: ora-29702: error occurred in cluster group service
- Rman-06031 cannot convert database keywords
猜你喜欢

Switch and router technology: dynamic routing protocol, rip routing protocol and OSPF routing protocol

Stm32fsmc extended SRAM

汉字风格迁移篇---通过生成对抗网络学习一对多程式化汉字的转换和生成

Codeforces Round #807 (Div. 2)

A series of problems about the number of DP paths

Principle of image nonlocal mean filtering
![[mathematical modeling] basic knowledge of MATLAB](/img/b5/6bd507a149968931ab1c4644f2c08b.png)
[mathematical modeling] basic knowledge of MATLAB
![[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)](/img/a0/b2b0f5fb63301f5b7dd14302aa39e2.png)
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)

Study of const of constant function

Spark Structured Streaming HelloWorld
随机推荐
YAPI安装
Why is mongodb fast
[mathematical modeling] analytic hierarchy process (AHP)
Add and modify the verification logic, and use -validation- to complete the group verification
SQL加解密注入详解
阿里云工业视觉智能工程师ACP认证——备考
Embedded practice -- CPU utilization statistics based on rt1170 FreeRTOS (24)
十、拦截器
Weights & biases (II)
Phaser (I): platform jumping collection game
2022 a.static query on tree (tree section)
What are the restrictions on opening futures accounts? Where is the safest place to open an account?
3、 @requestmapping annotation
Soft exam review and plan
滑动窗口——leetcode题解
快恢复二极管工作原理及使用
STM32开发 | AD7606并行多路采集数据
Use field parameters for report translation
2022杭电多校 DOS Card(线段树)
columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by mysql8.0解决办法