Stale value of Shared variable

后端 未结 4 438
青春惊慌失措
青春惊慌失措 2021-01-06 08:38

While reading Concurrency in practice I read that:

NoVisibility demonstrated one of the ways that insufficiently synchronized programs can c

4条回答
  •  爱一瞬间的悲伤
    2021-01-06 08:44

    It's not Java specific issue. Processors have caches. Without synchronization processor 1 can read a value into its cache from memory, modify it in its cache but never flush it, then processor 2 reads stale value from memory

提交回复
热议问题