Sun Studio Express: Data Race Detection Tool


NOTE: The Data Race Detection Tool (DRDT) has been renamed the THREAD ANALYZER (THA) in the December 2006 Sun Studio Express release.

For information on THA, go here

The information in this article about DRDT refers to the August 2006 Sun Studio Express release.

About the Data Race Detection Tool

This is a preliminary release of the Data Race Detection Tool (DRDT). Use DRDT to detect data-races that occur during the execution of a single, multi-threaded process.

A data-race occurs under the following conditions:

  • Two or more threads in a single process concurrently access the same memory location.
  • At least one of the threads is accessing the memory location for writing.
  • The threads are not using any exclusive locks to control their accesses to that memory.

When these three conditions hold, the order of accesses is non-deterministic. Therefore each run can give different results depending on the order of the accesses. Of course, some data-races may be benign (for example, when the memory access is used for a busy-wait), but many data-races are either bugs or caused by bugs in the program.

DRDT can detect data races that occur in code written using the POSIX thread API, the Solaris Operating System(R) thread API, OpenMP directives, Sun parallel directives, Cray(R) parallel directives, or a mix of these.

DRDT supports the following hardware and operating systems:

  • The SPARC(R) v8plus, v8plusa, v8plusb, v9, v9a, and v9b architectures
  • The Intel(R) x86 and AMD(R) x64 platforms
  • The Solaris 9 and Solaris 10 operating systems

See the Getting Started Guide for instructions on how to invoke and use DRDT.

Please note that DRDT is still in the development stage. The user model -- including instrumentation requirements, command names, command options, output formats, and GUI interface -- may change later in the product release cycle.


This release of DRDT includes the following features:

  • The new C, C++, and Fortran compiler option -xinstrument=datarace which instruments the source code during compilation. See rdt(1) for more information.
  • User APIs to notify DRDT of user-implemented custom synchronization schemes.
  • The runtime DRDT to generate data for data-race experiments.
  • Command line and GUI tools interfaces to examine the experiment results.

DRDT Documentation

This preliminary release is supported by the following documenation:

  • An FAQ answers a number of immediate questions.
  • The Getting Started Guide offers a quick introduction to the tool.
  • The DRDT Tutorial gives a worked example on using DRDT.
  • The following man pages are also available:
  • You can access online help for the new DRDT Races, Race Source, and Race Details tabs from the Help menu in the Sun Studio Performance Analyzer or DRDT GUI.

Limitations and Incompatibilities

The following are known limitations in DRDT.

  • DRDT can only detect data races in code that is instrumented at compile-time. You must recompile you code according to the instruction provided in the Getting Started tutorial in order to be instrumented.
  • DRDT is not able to recognize user-implemented synchronizations. It may report false data-races if your code contains such synchronizations. For example, DRDT does not recognize hand-coded assembly that implements spin locks as a synchronization point.
  • Running programs under DRDT can incur significant overhead depending on the nature of the application.
  • Asynchronous signal handling is not fully supported. Programs that use asynchronous signals may stall under DRDT.
  • In some cases, DRDT can only get the full callstack for one of the two accesses that contributes to a data-race.

Questions and Feedback

Sign on to the Sun Studio Tools user forums to post questions to Sun engineering and the community. You might find that your problem has already been solved. Be sure to state that you're using a Sun Studio Express build.

(Last Updated December 6, 2006)
Left Curve
Popular Downloads
Right Curve
Untitled Document