JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Thread Analyzer User's Guide     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  What is the Thread Analyzer and What Does It Do?

1.1 Getting Started With the Thread Analyzer

1.1.1 What is a Data Race?

1.1.2 What is a Deadlock?

1.2 The Thread Analyzer Usage Model

1.2.1 Usage Model for Detecting Data Races

1.2.1.1 Instrument the Code for Data Race Detection

Source-level Instrumentation

Binary-level Instrumentation

1.2.1.2 Create an Experiment on the Instrumented Application

1.2.1.3 Examine the Experiment for Data Races

1.2.2 Usage Model for Detecting Deadlocks

1.2.2.1 Create an Experiment for Detecting Deadlocks

1.2.2.2 Examine the Experiment for Deadlocks

1.2.3 Usage Model for Detecting Data Races and Deadlocks

1.3 Thread Analyzer Interface

2.  The Data Race Tutorial

3.  The Deadlock Tutorial

A.  APIs Recognized by the Thread Analyzer

B.  Useful Tips

1.1 Getting Started With the Thread Analyzer

The Thread Analyzer is a specialized view of the Performance Analyzer that is designed for examining thread analysis experiments. A separate command, tha, is used to start the Performance Analyzer with this specialized view, and the tool when started in this way is known as the Thread Analyzer.

The Thread Analyzer can show data races and deadlocks in experiments that you can generate specifically for examining these types of data, as explained in this document.

1.1.1 What is a Data Race?

The 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:

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

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

1.1.2 What is a Deadlock?

Deadlock describes a condition in which two or more threads are blocked forever because they are waiting for each other. There are many causes of deadlocks. The Thread Analyzer detects deadlocks that are caused by the inappropriate use of mutual exclusion locks. This type of deadlock is commonly encountered in multithreaded applications.

A process with two or more threads can deadlock when all of the following conditions are true:

Here is a simple example of a deadlock condition:

A deadlock can be of two types: A potential deadlock or an actual deadlock. A potential deadlock does not necessarily occur in a given run, but can occur in any execution of the program depending on the scheduling of threads and the timing of lock requests by the threads. An actual deadlock is one that occurs during the execution of a program. An actual deadlock causes the threads involved to hang, but may or may not cause the whole process to hang.