img
.
FIFO Mutexes
Every now and then, you come upon a program where you want to ensure that the thread that is
blocked on a mutex will be the next owner of the mutex--something which is not in the definition
of simple POSIX mutexes. Typically, this situation occurs when two threads both need a mutex to
do their work: They hold the mutex for a significant length of time, they do their work
independently of each other, and they have very little to do when they don't hold it. Thus, what
happens is that T1 grabs the mutex and does its work (see Figure 7-4), while T2 tries for the mutex,
and blocks. T1 then releases the mutex and wakes up T2. Before T2 manages to obtain the mutex,
T1 reacquires it. This is illustrated in case 2.
Figure 7-4. When FIFO Mutexes Are Valuable
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home