Identifying thread bottlenecks

The Thread View is the primary view for detecting thread bottlenecks. It displays a record of the activity of each of your program's threads, and helps you identify thread contentions and deadlocks.

Prerequisite: Collecting thread data

A contention occurs when a thread is waiting for a resource that is not readily available; it slows your code“s execution, but can clear up over time.

A deadlock occurs when a thread is waiting for a resource that a second thread has locked, and the second thread is waiting for a resource that the first thread has locked. More than two threads can be involved in a deadlock. A deadlock never resolves itself. It often causes the whole application, or the part that is experiencing the deadlock, to halt.

To locate thread contentions and deadlocks:

  1. Display the Thread View: Right-click your Thread Analysis profiling resource, and then in the pop-up menu select Open With > Thread View.
  2. In the Thread View, look for vertical arrows between threads. A single arrow indicates a thread contention: one thread is waiting for another thread to release a lock. Multiple arrows can indicate a deadlock. A diamond-shaped marker indicates that a thread is waiting for a lock, but the thread that holds the lock cannot be determined.
  3. Pause your cursor over a thread segment that is waiting for a lock. This displays a tool-tip that specifies the name of the lock and identifies the thread that is holding the lock.

Here is an example of a contention:

Image of Thread View window with a vertical arrow that indicates a contention

Here is an example of a deadlock:

Image of Thread View window with a pair of vertical arrows that indicate a deadlock

Note: Profiling a program with the Execution Time Analysis profiling type allows you to collect and display thread data, but only for threads in the Running and Dead states. To display bottlenecks, you must include the Thread Analysis profiling type in your profiling set.

The following topics provide instructions for controlling the Thread View:

Parent topic: Detecting thread bottlenecks

Related tasks
Identifying the methods behind thread bottlenecks

Related reference
The Thread View

Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.