Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Sheriff: Precise Detection and Automatic Mitigation of False Sharing

Tongping Liu, Emery D. Berger

Copyright (C) 2011-2012 University of Massachusetts Amherst

Building Sheriff

Running make builds two variants of the Sheriff library, in 32-bit and 64-bit versions:

  1. Sheriff_Protect: Use either or as a replacement for the pthreads library to automatically eliminate false sharing problems.

  2. Sheriff_Detect: Use either or to find false sharing problems (reported after the program finishes execution).

***NOTE: You may need to install the 32-bit libraries in order to build 32-bit executables. On Debian, for example, type sudo yum install glibc-devel.i686 and sudo yum install libstdc++.i686.

Using Sheriff

Sheriff currently supports Linux x86 platforms.

  1. Compile your program to object files (here, we use just one, target.o).

  2. Link to the appropriate Sheriff library. There are two options (neither of which is particular to Sheriff).

(a) Dynamic linking: this approach requires no environment variables, but the Sheriff library needs to be in a fixed, known location. Place the Sheriff library in a directory, e.g., SHERIFF_DIR. Then compile your program as follows:

  % g++ target.o -rdynamic SHERIFF_DIR/ -ldl -o target

(b) Ordinary dynamic linking: this approach is more flexible (you can change the location of the Sheriff library), but you must also set the LD_LIBRARY_PATH environment variable.

  % g++ target.o -LSHERIFF_DIR -lsheriff_variant -dl -o target

When using Sheriff_Detect, all reports of any discovered false sharing instances are printed out after the program finishes execution.

Citing Sheriff

If you use Sheriff, we would appreciate hearing about it. To cite Sheriff, please refer to the following paper, included as sheriff-oopsla2011.pdf.

 author = {Liu, Tongping and Berger, Emery D.},
 title = {SHERIFF: precise detection and automatic mitigation of false sharing},
 booktitle = {Proceedings of the 2011 ACM International Conference on Object-Oriented Programming Systems, Languages, and Applications},
 series = {OOPSLA '11},
 year = {2011},
 isbn = {978-1-4503-0940-0},
 location = {Portland, Oregon, USA},
 pages = {3--18},
 numpages = {16},
 url = {},
 doi = {},
 acmid = {2048070},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {false sharing, multi-threaded},


Sheriff consists of two tools: Sheriff-Detect, a false-sharing detector, and Sheriff-Protect, a false-sharing eliminator that you can link with your code to eliminate false sharing.




No releases published


No packages published