Chapter 7 PROCESS SYNCHRONIZATION The first known correct software solution to the critical-section problem for two threads was developed by Dekker; it is shown in Figure . The two threads, T0 and T1, coordinate activity sharing an object of class Dekker. Show that the algorithm satisfies all three requirements for the critical-section problem. Answer: No answer. In Chapter 5, we gave a multithreaded solution to the bounded-buffer problem that used message passing. The MessageQueue class is not considered thread safe, meaning that a race condition is possible when multiple threads attempt to concurrently access the queue. Modify the MessageQueue class using Java synchronization such that it is thread-safe. Answer: Please refer to the supporting Web site for source code solution. Create a BinarySemaphore class that implements a binary semaphore. Answer: Please refer to the supporting Web site for source code solution. The wait() statement in all Java program examples was part of a while loop. Explain why you would always need to use a while statement when using the wait(), and why you would never use an if statement. Answer: This is an important issue to emphasize! Java only provides anonymous notifi- cation—you cannot notify a certain thread that a certain condition is true. When a thread is notified, it is its responsibility to re-check the