---
title: "Meaning & Key Takeaway of: Accessing shared, mutable data requires…"
description: "\"“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a sing..."
image: "https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg"
---

#  Accessing shared, mutable data requires using…

![“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](https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg)   [Download](https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg) [Open image](https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg)

> ““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](https://sms4smile.com/quotes/author/brian-goetz/)

## About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

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.

★ ★ ★ ★ ★   No ratings yet

[Concurrency](https://sms4smile.com/quotes/about/concurrency/) [Programming](https://sms4smile.com/quotes/about/programming/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.”](https://sms4smile.com/quotes/brian-goetz/it-is-far-easier-to-design-a-class-to-be-thread-safe-than-to-retrofit/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in…](https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it…](https://sms4smile.com/quotes/brian-goetz/when-a-field-is-declared-volatile-the-compiler-and-runtime-are-put-on/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always…](https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”](https://sms4smile.com/quotes/brian-goetz/locking-can-guarantee-both-visibility-and-atomicity-volatile/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements…](https://sms4smile.com/quotes/brian-goetz/immutable-objects-are-simple-they-can-only-be-in-one-state-which-is/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and…](https://sms4smile.com/quotes/brian-goetz/debugging-tip-for-server-applications-be-sure-to-always-specify-the/)

[Brian Goetz](https://sms4smile.com/quotes/author/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…](https://sms4smile.com/quotes/brian-goetz/the-possibility-of-incorrect-results-in-the-presence-of-unlucky/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make…](https://sms4smile.com/quotes/brian-goetz/just-as-it-is-a-good-practice-to-make-all-fields-private-unless-they/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason…](https://sms4smile.com/quotes/brian-goetz/once-an-object-escapes-you-have-to-assume-that-another-class-or/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access…](https://sms4smile.com/quotes/brian-goetz/whenever-more-than-one-thread-accesses-a-given-state-variable-and-one/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“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.…](https://sms4smile.com/quotes/brian-goetz/compound-actions-on-shared-state-such-as-incrementing-a-hit-counter/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

## More by Brian Goetz

> [“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in…](https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access…](https://sms4smile.com/quotes/brian-goetz/whenever-more-than-one-thread-accesses-a-given-state-variable-and-one/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason…](https://sms4smile.com/quotes/brian-goetz/once-an-object-escapes-you-have-to-assume-that-another-class-or/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make…](https://sms4smile.com/quotes/brian-goetz/just-as-it-is-a-good-practice-to-make-all-fields-private-unless-they/)

[Brian Goetz](https://sms4smile.com/quotes/author/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…](https://sms4smile.com/quotes/brian-goetz/the-possibility-of-incorrect-results-in-the-presence-of-unlucky/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and…](https://sms4smile.com/quotes/brian-goetz/debugging-tip-for-server-applications-be-sure-to-always-specify-the/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements…](https://sms4smile.com/quotes/brian-goetz/immutable-objects-are-simple-they-can-only-be-in-one-state-which-is/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”](https://sms4smile.com/quotes/brian-goetz/locking-can-guarantee-both-visibility-and-atomicity-volatile/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.”](https://sms4smile.com/quotes/brian-goetz/it-is-far-easier-to-design-a-class-to-be-thread-safe-than-to-retrofit/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always…](https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it…](https://sms4smile.com/quotes/brian-goetz/when-a-field-is-declared-volatile-the-compiler-and-runtime-are-put-on/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“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.…](https://sms4smile.com/quotes/brian-goetz/compound-actions-on-shared-state-such-as-incrementing-a-hit-counter/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

[Explore all 13 Brian Goetz quotes ](https://sms4smile.com/quotes/author/brian-goetz/)

## More Concurrency quotes

> [“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in…](https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access…](https://sms4smile.com/quotes/brian-goetz/whenever-more-than-one-thread-accesses-a-given-state-variable-and-one/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason…](https://sms4smile.com/quotes/brian-goetz/once-an-object-escapes-you-have-to-assume-that-another-class-or/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make…](https://sms4smile.com/quotes/brian-goetz/just-as-it-is-a-good-practice-to-make-all-fields-private-unless-they/)

[Brian Goetz](https://sms4smile.com/quotes/author/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…](https://sms4smile.com/quotes/brian-goetz/the-possibility-of-incorrect-results-in-the-presence-of-unlucky/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and…](https://sms4smile.com/quotes/brian-goetz/debugging-tip-for-server-applications-be-sure-to-always-specify-the/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements…](https://sms4smile.com/quotes/brian-goetz/immutable-objects-are-simple-they-can-only-be-in-one-state-which-is/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”](https://sms4smile.com/quotes/brian-goetz/locking-can-guarantee-both-visibility-and-atomicity-volatile/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.”](https://sms4smile.com/quotes/brian-goetz/it-is-far-easier-to-design-a-class-to-be-thread-safe-than-to-retrofit/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always…](https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it…](https://sms4smile.com/quotes/brian-goetz/when-a-field-is-declared-volatile-the-compiler-and-runtime-are-put-on/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“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.…](https://sms4smile.com/quotes/brian-goetz/compound-actions-on-shared-state-such-as-incrementing-a-hit-counter/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

[Browse all 13 Concurrency quotes ](https://sms4smile.com/quotes/about/concurrency/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“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.”",
            "creator": {
                "@type": "Person",
                "name": "Brian Goetz"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/",
            "about": {
                "@type": "Thing",
                "name": "Concurrency"
            },
            "@id": "https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg",
                "url": "https://sms4smile.com/quotes/i/1c8/brian-goetz-35377_concurrency_accessing-shared-mutable-data-requires-u_1188146.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not…” — Brian Goetz",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Brian Goetz",
                    "item": "https://sms4smile.com/quotes/author/brian-goetz/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“Accessing shared, mutable data requires using...",
                    "item": "https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
