“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it should not be reordered with other memory operations. Volatile variables are not cached in registers or in caches where they are hidden from other processors, so a read of a volatile variable always returns the most recent write by any thread.”
“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”
“book variables, student variables, and school variables.”
“Compound actions on shared state, such as incrementing a hit counter (read-modify-write) or lazy initialization (check-then-act), must be made atomic to avoid race conditions. Holding a lock for the entire duration of a compound action can make that compound action atomic. However, just wrapping the compound action with a synchronized block is not sufficient; if synchronization is used to coordinate access to a variable, it is needed everywhere that variable is accessed. Further, when using locks to coordinate access to a variable, the same lock must be used wherever that variable is accessed.”
“In mathematics, in place of characters, you have variables or unknowns. If I'm trying to plot a theorem, I try to imagine these variables interacting with each other. The boundary of their interaction is the theorem.”
“Life is volatile.”