1. What is the Thread Analyzer and What Does It Do?
1.1 Getting Started With the Thread Analyzer
1.4 The Thread Analyzer Usage Model
1.4.1 Usage Model for Detecting Data Races
1.4.1.1 Instrument the Code for Data Race Detection
1.4.1.2 Create an Experiment on the Instrumented Application
1.4.1.3 Examine the Experiment for Data Races
1.4.2 Usage Model for Detecting Deadlocks
1.4.2.1 Create an Experiment for Detecting Deadlocks
1.4.2.2 Examine the Experiment for Deadlocks
1.4.3 Usage Model for Detecting Data Races and Deadlocks
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:
Threads that are already holding locks request new locks
The requests for new locks are made concurrently
Two or more threads form a circular chain in which each thread waits for a lock which is held by the next thread in the chain
Here is a simple example of a deadlock condition:
Thread 1 holds lock A and requests lock B
Thread 2 holds lock B and requests lock A
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.