Quotessence
Home / Quotes / Quote by Brian Goetz

Quote by Brian Goetz

“The possibility of incorrect results in the presence of unlucky timing is so important in concurrent programming that it has a name: a race condition. A race condition occurs when the correctness of a computation depends on the relative timing or interleaving of multiple threads by the runtime; in other words, when getting the right answer relies on lucky timing.”

Quote by Brian Goetz

Work

Java Concurrency in Practice

Browse quotes and source details for this work. more

Author

Brian Goetz

Browse famous quotes and profile details for Brian Goetz. more

You May Also Like

“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.”

“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and testing. The server JVM performs more optimization than the client JVM, such as hoisting variables out of a loop that are not modified in the loop; code that might appear to work in the development environment (client JVM) can break in the deployment environment (server JVM).”

“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a single thread, no synchronization is needed. This technique, thread confinement, is one of the simplest ways to achieve thread safety. When an object is confined to a thread, such usage is automatically thread-safe even if the confined object itself is not.”

“You know, when you talked about good days and bad days, do you think right now counts as the good days?” “It depends. How do you feel right now?” Rania closed her eyes when she said, “I feel strange. I haven’t felt like this for a long time.” Zaheed took a deep breath. “How so?” She shrugged. “Perhaps, it’s because I’m in a whole new place, where I haven’t set my foot before; the air smelt different and I’m talking to a stranger. It made me feel like I’ve just had all my memories erased and replaced with new ones.”