Skip to content

Concurrency Quote by Brian Goetz

“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…” quote by Brian Goetz
Download Open image
““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.””

Brian Goetz

About This Quote

Source Book: Java Concurrency in Practice, 2006

Thread confinement avoids synchronization by keeping data within a single thread, making it inherently safe.

In simple terms: Keep data to one thread to stay safe.

Key Takeaway

Use thread confinement for simple thread safety.

Themes

concurrency thread safety software design

Mood

practical technical

Type

advice explanatory

When to use this quote

  • single-threaded tasks
  • UI updates
  • temporary objects
  • performance-critical sections

Key Concepts

thread confinement mutability synchronization parallelism

Questions to Reflect On

  • Can you identify code that could be confined?
  • What are the trade‑offs of confinement vs. locking?
A Different Perspective

If data must be shared, confinement isn’t possible, requiring other mechanisms.

3.5 out of 5 (3 ratings)

More by Brian Goetz

Explore all 13 Brian Goetz quotes

More Concurrency quotes

Browse all 13 Concurrency quotes