Oracle® Solaris Studio 12.4: Thread Analyzer User's Guide

Exit Print View

Updated: December 2014

What is a Data Race?

    Thread Analyzer detects data races that occur during the execution of a multithreaded process. A data race occurs when all of the following are true:

  • Two or more threads in a single process access the same memory location concurrently

  • At least one of the accesses is for writing

  • The threads are not using any mutual exclusive locks to control their accesses to that memory

When these three conditions hold, the order of accesses is non-deterministic, and the computation might give different results from run to run depending on that order. Some data races might be benign (for example, when the memory access is used for a busy-wait), but many data races are bugs in the program.

Thread Analyzer works on a multithreaded program written using the POSIX thread API, Oracle Solaris thread API, OpenMP, or a mix of these.