False sharing

False sharing

In computer science, false sharing is a performance degrading usage pattern that can arise in systems with distributed, coherent caches at the size of the smallest resource block managed by the caching mechanism. When a system participant attempts to periodically access data that will never be altered by another party, but that data shares a cache block with data that "is" altered, the caching protocol may force the first participant to reload the whole unit despite a lack of logical necessity. The caching system is unaware of activity within this block and forces the first participant to bear the caching system overhead required by true shared access of a resource.

By far the most common usage of this term is in modern multiprocessor CPU caches, where memory is cached in lines of some small power of two word size (e.g., 64 aligned, contiguous bytes). If two processors operate on independent data in the same memory address region storable in a single line, the cache coherency mechanisms in the system may force the whole line across the bus or interconnect with every data write, forcing memory stalls in addition to wasting system bandwidth. False sharing is an inherent artifact of automatically synchronized cache protocols and can also exist in environments such as distributed file system or databases, but current prevalence is limited to RAM caches.

Trivial Code Example

struct foo{ volatile int x; volatile int y;};

foo f;

int sum_a(){ int s = 0; for (int i = 0; i < 1000000; ++i) s += f.x; return s;}

void inc_b(){ for (int i = 0; i < 1000000; ++i) ++f.y;}

Here, sum_a may need to continually re-read x from main memory (instead of from cache) even though inc_b's modification of y should be irrelevant. It should be noted that a modern compiler may, despite the volatile keyword, optimize this example's activity in the loops to use inherently unsynchronized registers instead of repeated memory accesses, avoiding using the cache and preventing any false sharing.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Legal aspects of file sharing — Part of a series on File sharing Technologies Peer to peer  …   Wikipedia

  • Trade group efforts against file sharing — Arts and media industry trade groups such as the Recording Industry Association of America (RIAA) and Motion Picture Association of America (MPAA) strongly oppose and attempt to prevent copyright infringement through file sharing. The… …   Wikipedia

  • Odex's actions against file-sharing — Odex s head office at International Plaza, where the out of court settlements to the company by alleged illegal downloaders were made. Odex s actions against file sharing were legal actions against Internet Service Providers (ISPs) and their… …   Wikipedia

  • power-sharing —    A system of government by which in deeply divided societies power is shared between different communities or segments of society. It is a strategy for resolving disputes over who should have the most powerful position in the social and… …   Glossary of UK Government and Politics

  • OpenMP — Original author(s) OpenMP Architecture Review Board[1] Developer(s) OpenMP Architecture Review Board …   Wikipedia

  • Hoard memory allocator — The Hoard memory allocator, or Hoard, is a memory allocator for Linux, Solaris, Microsoft Windows and other operating systems. Hoard can improve the performance of multithreaded applications by providing fast, scalable memory management functions …   Wikipedia

  • ThreadSpotter — est un outil qui diagnostique les problèmes de performances liés à la localité des données, à l utilisation du cache et à l interaction des threads. De manière générale, la bande passante du bus mémoire n a pas connu les mêmes améliorations que… …   Wikipédia en Français

  • Computers and Information Systems — ▪ 2009 Introduction Smartphone: The New Computer.       The market for the smartphone in reality a handheld computer for Web browsing, e mail, music, and video that was integrated with a cellular telephone continued to grow in 2008. According to… …   Universalium

  • biblical literature — Introduction       four bodies of written works: the Old Testament writings according to the Hebrew canon; intertestamental works, including the Old Testament Apocrypha; the New Testament writings; and the New Testament Apocrypha.       The Old… …   Universalium

  • Vehicular cycling — (also known as integrated cycling, integrated traffic cycling, cooperative cycling, and bicycle driving) is the practice of riding bicycles on roads in a manner that is visible, predictable, and in accordance with the principles for driving in… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”