KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I think I understand the happened-before relationship for single variables. If I write a volatile field, all subsequent reads of this field will contain this new value. Writing a volatile crosses the memory barrier and flushes new value to main memory. I still am not clear on what happens in all other cases - for instance Thread.start() , synchronized or new locks in java.util.concurrent . What does it mean that they also cross memory barrier? What data is flushed from local cache to main memory? In other words, what is the scope of the crossing ? Is everything always flushed? Now back to volatile , does it flush more than just the single volatile field?
Tags (comma-separated)
Save Edits
Cancel