Java中的可见性问题是由JVM还是硬件引起的?
以前我认为可见性问题是由CPU Cache 引起的性能问题。
但我看到这篇文章: http://www.ibm.com /developerworks/java/library/j-5things15/index.html
在第3.易失性变量段落中,它告诉Thread持有缓存,听起来缓存是由JVM引起的。
答案是什么? JVM 还是硬件?
Previously I think the Visibility Problem is cause by CPU Cache for performance.
But I saw this article: http://www.ibm.com/developerworks/java/library/j-5things15/index.html
In the paragraph 3. Volatile variables, it tells that Thread holds the cache, sounds like the cache is caused by JVM.
What's the answer? JVM or Hardware?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JVM 给了你一些弱保证。编译器和硬件会给你带来问题。 :-)
另请参阅 JSR 133(Java 内存模型和线程规范修订版)http://jcp.org/en/jsr/detail?id=133 它与 JDK 1.5 一起发布。
JVM gives you some weak guarantees. Compiler and Hardware cause you problems. :-)
See also JSR 133 (Java Memory Model and Thread Specification Revision) http://jcp.org/en/jsr/detail?id=133 It was released with JDK 1.5.