Before you begin, you must complete Exercise 1.2 Collecting thread data.
The Thread View displays the status of all the threads in your application, and explicitly indicates thread deadlocks and contentions.
To find bottlenecks:
The vertical arrows between threads are what interest us. An arrow indicates that one thread (the thread in which the arrow originates) is waiting for another thread (the thread to which the arrow is pointing) to release a lock. A double arrow indicates that two threads are in a deadlocked state, both waiting for the other to release a lock.
Soon after the program starts, four philo* threads are created, one after the other. Each thread runs for a short while and then makes a request for a lock. The requests are not successful. When the the first three lock requests fail, the threads enter a Waiting for Lock state. When the lock request for the fourth thread fails, deadlock occurs, and the display indicates that all four threads are in a Deadlocked state.
The philo* threads are waiting for a lock from other philo* threads that are also waiting for a lock. In this case, we have a deadlock: The program reaches an impasse and cannot continue.
Note: You can see specific information about lock requests,
deadlocks, and other states by pausing your cursor over a particular thread segment. This displays a tool-tip that specifies,
for example, the name of a lock and identifies the thread that is holding the lock (the "Locking Thread").
Now that you understand why this deadlock occurs, you are ready to begin Exercise 1.4: Resolving the thread bottleneck.