`
saillanbo
  • 浏览: 10656 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

java concurrency in practice 读书笔记

    博客分类:
  • java
阅读更多
In the absence of synchronization, the compiler, processor, and runtime can do some downright weird things to the order in which operations appear to execute. Attempts to reason about the order in which memory actions "must" happen in insufflciently synchronized multithreaded programs will almost certainly be incorrect.
  线程中的非明确同步代码可能会按照非预订的顺序执行

** volatile 变量 要慎用  。 是弱化的的 Synchronized  一般是用来做一些completion, interruption, or status flag。

Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics