当前位置:网站首页>The difference between synchronize and volatile
The difference between synchronize and volatile
2022-06-25 22:39:00 【No trace after wind 2018】
synchronize and volatile The difference between
volatile Can only be used to decorate variables ,synchronize Can be used to modify methods 、 Code block . With jdk Technological development ,synchronize The implementation efficiency will be greatly improved , therefore synchronize It is still common in the project process ;
Multithreaded access volatile There will be no blockage ; and synchronize There will be a blockage ;
volatile It can ensure the synchronization of variables between private memory and main memory , But the atomicity of variables cannot be guaranteed ;synchronize Variable atomicity can be guaranteed ;
volatile Is the visibility of variables between threads ;synchronize Is the synchronization of accessing resources between multiple threads ;
about volatile Decorated variable , It can solve the visibility problem of variable reading , There is no guarantee of atomicity . For multiple threads accessing the same instance variable, lock synchronization is still required .
边栏推荐
- Client cannot authenticate via:[TOKEN, KERBEROS]
- [proteus simulation] Arduino uno+ key controls 2-bit digital tube countdown
- Use of local stack in flask
- How to use the find command
- Practice of product library platform nexus of Devops
- 在线CRUDhasone关联查询报错Unabletouseinternalvariable:List
- Webrtc crash course
- Yyds dry goods inventory CEPH installation visual dashboard
- 2022-2028 global TFT LCD touch screen industry research and trend analysis report
- Obsidian基础教程
猜你喜欢

2022-2028 global industrial TFT LCD industry survey and trend analysis report

Practice of product library platform nexus of Devops

2022-2028 global RBI platform industry research and trend analysis report
In depth analysis of Flink fine-grained resource management

聊聊Adapter模式

2022-2028 global variable frequency compressor technology industry research and trend analysis report

Cvpr2022 tutorial | machine learning remote sensing processing: agriculture and food security, University of Maryland

2022-2028 global vacuum jacket system industry survey and trend analysis report

Nacos 源码分析01 代码结构

Zhihu Gaozan: what ability is important, but most people don't have it?
随机推荐
ITU AI and multimedia Seminar: exploring new areas and cross SDO synergy
Sqlmap learning (sqli labs as an example)
Dio encapsulated by the flutter network request (cookie management, adding interceptors, downloading files, exception handling, canceling requests, etc.)
图解栈帧运行过程
Practice of product library platform nexus of Devops
[动态规划]最长回文子串-对于动态转移循环顺序的思考
Yyds dry goods inventory JD 2, why is redis so fast?
用idea建立第一個網站
华为云短信测了很多手机都提示发送频繁
MySQL modifies multiple tables and adds multiple fields through SQL
Understand which C standards are there & understand the C compilation pipeline
Various special effect cases of Experiment 3
MATLAB Programming Notes
SSH modifies grub in heiqunhui ds918+ system 7.0.1 cfg
A3.ansible production practice case -- system initialization roles
Hard liver! Super detailed basic introduction to Matplotlib!!!
What is the difficulty of the form tool that costs billions of dollars? Exclusive interview with si no
China coated abrasive tools industry market depth analysis and development strategy consulting report 2022-2028
How to use the find command
2022-2028 global proton exchange membrane hydrogen electrolyzer industry survey and trend analysis report