Sun Java Solaris Communities My SDN Account Join SDN
 
Downloads

Sun Studio Express - Thread Analyzer README

 

Contents

About the Thread Analyzer
Platforms
How to Download
Features
Thread Analyzer Documentation
Limitations and Incompatibilities
Questions and Feedback

About the Thread Analyzer

This is a preliminary release of the Thread Analyzer. The Thread Analyzer is a tool that analyzes the execution of a multi-threaded program and checks for a variety of multi-threaded programming errors such as data races and deadlocks.

The tool can detect errors in code that is written using the POSIX thread API, the Solaris Operating System(R) thread API, OpenMP API, Sun parallel directives, Cray(R) parallel directives, or a mix of these.

Data Races

A data race occurs under the following conditions:

  • Two or more threads in a process concurrently access the same memory location,
  • At least one of the threads is accessing the memory location for writing, and
  • 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. 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.

Deadlocks

Deadlock describes a condition where two or more threads are blocked (hang) forever, waiting for each other. Suppose we have a process with two or more threads. A deadlock occurs when the following three conditions hold:

  • Threads already holding locks request new locks,
  • The requests are made concurrently, and
  • Two or more threads form a circular chain where each thread waits for a lock that the next thread in the chain holds.
Here is an example of a deadlock condition:

Thread 1: holds lock A, requests lock B
Thread 2: holds lock B, requests lock A

A deadlock can be of two types: A "potential deadlock" or an "actual deadlock". A potential deadlock is a deadlock that did not occur in a given run, but can occur in different runs of the program depending on the timings of the requests for locks by the threads. An actual deadlock is one that actually occured in a given run of the program. An actual deadlock causes the threads involved to hang, but may or may not cause the whole process to hang.

See the Getting Started Guide for instructions on how to use the Thread Analyzer.

Please note that the Thread Analyzer 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.

Platforms

The Thread Analyzer 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, Solaris 10, and Linux operating systems
  • The SuSE Linux Enterprise Server 9 and Red Hat Enterprise Linux 4 operating systems

How to Download

The Thread Analyzer is part of the Sun Studio software. To download and install the Sun Studio Express build which includes the Thread Analyzer, follow the instructions on the Sun Studio Express page.

Features

This release of the Thread Analyzer includes the following features:

  • The new C, C++, and Fortran compiler option -xinstrument=datarace which instruments the source code during compilation. See tha(1) for more information.
  • User APIs to notify the Thread Analyzer of user-implemented custom synchronization schemes.
  • Command line and GUI tools interfaces to create an experiment and examine the results.

Thread Analyzer Documentation

This preliminary release is supported by the following documentation:

  • An FAQ answers a number of immediate questions.
  • The Getting Started Guide offers a quick introduction to the tool.
  • The tutorial on using the Thread Analyzer for data race detection gives a working example of how to use the Thread Analyzer for data race detection.
  • The tutorial on using the Thread Analyzer for deadlock detection gives a working example of how to use the Thread Analyzer for (potential and actual) deadlock detection.
  • The following man pages are also available:
  • You can access online help for the new Races, Dual Source, and Race Details tabs from the Help menu in the Sun Studio Performance Analyzer or Thread Analyzer GUI.

Limitations and Incompatibilities

The following are known limitations in the Thread Analyzer.

Questions and Feedback

Sign on to the Sun Studio Tools Forum 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.

(Page last modified February 12, 2007)