A progress indicator can interfere with the work it observes. Imagine an application in which several worker threads process independent portions of data and frequently publish how many items they have finished. Another thread reads those counts to update the screen. No worker changes another worker’s counter. Nevertheless, adding workers could increase completion time. This is a thought experiment, not an editorial benchmark. It exposes a gap between the independence intended by the programmer and the sharing recognized by the processor.
The arrangement looks convincing on screen. Each thread owns a separate object, the final total is correct, and no lock surrounds the entire array. The program has achieved semantic independence. Small objects, however, often sit next to one another. When several occupy the same cache line, hardware maintains coherence for their copies at that shared granularity. Separate variable names do not create separate coherence units. This is where false sharing begins.
The word false describes sharing from the program’s perspective. The machine’s communication is real. One participant writes its portion of a line, another reads or writes a neighboring portion, and the coherence protocol must coordinate access to the line. The Linux kernel documentation illustrates why a writer and a reader can be enough. All participants need not continuously change their own values. An otherwise immutable field can suffer from proximity to frequently modified data.
Our observer therefore deserves attention. Reading counters does not make it a neutral spectator. Its reads participate in access to the same lines. Possible costs depend on publication frequency, reading frequency, and where threads execute. Making the window draw faster would miss the issue until the actual waiting has been identified. A user sees slow processing, while the cause might belong to the mechanism intended to report that processing.
Neighbors absent from the original design
For arithmetic alone, assume a 64-byte cache line and eight counters of eight bytes each. If the first counter starts at a line boundary and the objects are contiguous, the entire set occupies one line. Thread zero accesses the first eight bytes; the next thread accesses the next eight. Their ranges do not overlap, yet their addresses belong to one line. The 64-byte size is an explicit assumption here, not a universal architectural constant.
Do not picture an obligatory write of the whole line to main memory after every change. A modern coherent machine can transfer data and ownership between caches through different mechanisms. We need only the narrower claim: coordination operates on the shared line and can restrict accesses that are independent at object level. Replacing that claim with perpetual trips to DRAM would misdescribe the mechanism and send an investigation toward a different bottleneck.
Remove writes and leave only reads of unchanged data, and the original source of repeated disruption to shared reading disappears. Dense placement is therefore not intrinsically defective. It often helps by reducing the number of lines fetched and fitting more useful data into cache. The problem belongs to a particular combination of layout and behavior. One object layout can suit sequential execution and perform poorly when several cores modify different parts concurrently.
Language-level correctness remains essential. If a worker writes an ordinary variable while the observer reads it concurrently without appropriate synchronization, the program already has a correctness problem. False sharing cannot explain away a data race. Our hypothetical scene assumes valid atomic counters or another lawful communication mechanism. We are discussing the cost of a correct program, not trying to compensate for missing access rules by moving bytes around.
Atomicity does not promise low cost. It specifies required properties of operations without removing physical proximity between objects. A weaker atomic memory order, when the algorithm permits it, may change some synchronization costs. It does not itself put counters on separate cache lines. Conversely, ordinary variables placed far apart do not become a safe communication channel. Correct access and suitable layout answer different questions, even when both are addressed in one source file.
Now change placement alone. Giving each counter its own properly aligned region can remove interference between adjacent independent counters. Our eight-object example then consumes more memory. Merely inserting some unused bytes proves little: the element’s size, alignment, and array stride all matter. A poorly aligned structure can cross a boundary precisely where its author expected isolation. Padding and alignment must describe the actual objects rather than an appealing drawing.
An Intel VTune case study documents an investigation of this effect. Its measurements belong to the application and platform described there. They are not estimates for our invented progress indicator. The useful lesson concerns the relationship between addresses, object layout, and observed cost. Importing a published speedup into another program would turn a documented example into a promise its author never made.

A separate line for every value still does not isolate that value from its reader. The observer reads a counter that a worker modifies. That is real sharing of the same value. Separating objects removes unwanted proximity but cannot abolish intended communication. Frequent publication may remain costly after layout has been corrected. This exposes the limit of the familiar recommendation to add padding: it addresses a particular component of the cause.
Another behavior is possible. A worker can count completed items locally and publish the accumulated total occasionally. The display then advances in batches. This reduces communication frequency when the application does not require continuously precise progress. It also changes the interface contract: the displayed count lags between publications. That may be acceptable for a progress indicator. It is insufficient reasoning for a signal that authorizes another thread to consume completed data.
A readiness message means more than its number. If a new counter value grants permission to read a processed object, the required writes must become visible through the appropriate synchronization mechanism. Replacing frequent atomic communication with an occasional ordinary store is not an automatic solution. We deliberately consider a statistical counter rather than a universal data-publication protocol. Frequency can change only where the program’s required behavior survives that change.
Looking behind overall utilization
High CPU utilization carries no built-in explanation. Threads may perform useful arithmetic, wait for other resources, or spend time interacting. One busy chart cannot reveal which variables became neighbors. Even deterioration after adding threads does not establish false sharing: true contention for one object, memory limitations, and other causes remain possible. The hypothesis strengthens when access behavior can be connected to specific addresses and changes in completion time.
The perf c2c tool can help make that connection. It analyzes cache-to-cache behavior and cache-line contention using supported hardware events. Capabilities depend on the processor and kernel; the presence of the command does not guarantee that a particular observation method is available. Its report also cannot replace reading the data structure. True sharing of one field and false sharing between different fields can leave related evidence.
Suppose a report identifies a hot line containing two counters. That is a useful lead, not a finished demonstration. Which instructions access which offsets? Which threads run concurrently? Do the fields actually belong to independent operations? A shared control flag might occupy the same line. Some communication would then be required by the algorithm. Moving every field changes several conditions at once, making it premature to assign the entire improvement to a single cause.
A useful comparison keeps useful work constant while explicitly changing the property under investigation. Versions with equal publication frequency can investigate placement. Versions with unchanged layout can investigate communication frequency. This describes the logic of a possible study, not measurements we conducted. Repetition and information about the compiler and thread placement matter: an accidental scheduling change can make one run look convincingly fast without producing a durable improvement.
The compiler also participates. A local counter can remain in a register and be stored only at the end when language rules permit that transformation. A specially written test of neighboring variables could consequently measure something other than the continuous communication its author intended. Actual accesses must be established from generated code and the program’s allowed behavior. Adding volatile to obtain an attractive graph is not equivalent to modeling valid communication between threads.
An overly broad correction has its own cost. Expanding a small object to a line can enlarge an array’s working set and the number of pages it touches. For single-threaded reading, the old density was useful. Layout decisions therefore often distinguish frequently modified fields, rarely read information, and data best processed together. Keeping everything apart universally is as crude as packing everything tightly regardless of access behavior.
Thread movement adds another complication. Relationships between caches and the coordination path can change. Running on logical threads of one physical core is not the same experiment as running on different cores or NUMA nodes. A CPU family name or shared-cache capacity cannot price every store in advance. Actual execution placement helps interpret the result. Hardware topology supplements the mechanism rather than abolishing it.
Return to the display. Its update frequency is a user-facing decision: how fresh must information be to help a person, and how much interaction is justified to provide it? Sometimes less frequent updates preserve an exact final result. Sometimes statistics need a different collection mechanism. False sharing exposes how a decision made for convenient observation can intrude into computation through a few neighboring bytes.
Our hypothetical indicator has no published speedup. It has an explainable relationship: independent workers can become cache-line neighbors, the observer introduces genuine communication, and occasional publication changes freshness requirements. After examining that relationship, updating the screen less frequently becomes a concrete change to interaction. Its benefit still needs checking in the program for which the screen exists.



