Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

深入理解Java虚拟机第三版-12.3.3,对于volatile两项特性的描述有些含糊其辞 #200

Open
chainray01 opened this issue Jun 12, 2023 · 0 comments

Comments

@chainray01
Copy link

当一个变量被定义成volatile之后,它将具备两项特性:第一项是保证此变量对所有线程的可见性,这里的“可见性”是指当一条线程修改了这个变量的值,新值对于其他线程来说是可以立即得知的。而普通变量并不能做到这一点,普通变量的值在线程间传递时均需要通过主内存来完成。比如,线程A修改一个普通变量的值,然后向主内存进行回写,另外一条线程B在线程A回写完成了之后再对主内存进行读取操作,新变量值才会对线程B可见。

此处只看得到第一项

@chainray01 chainray01 changed the title 深入理解Java虚拟机第三版,12.3.3对于volatile两项特性的描述有些含糊其辞 深入理解Java虚拟机第三版-12.3.3,对于volatile两项特性的描述有些含糊其辞 Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant