Why we need to use a while statement when using wait method, Operating System

Q. The wait() statement in every Java program examples was part of a while loop. Describe why you would always need to use a while statement when using wait() and why you would never use an if statement.

Answer: This is a significant issue to emphasize! Java only provides anonymous notification-you can't notify a certain thread that a certain condition is true. When a thread is informed it is its responsibility to re-check the condition that it is waiting for. If a thread didn't recheck the condition it might have received the notification without the condition having been met.

Posted Date: 7/27/2013 3:55:31 AM | Location : United States







Related Discussions:- Why we need to use a while statement when using wait method, Assignment Help, Ask Question on Why we need to use a while statement when using wait method, Get Answer, Expert's Help, Why we need to use a while statement when using wait method Discussions

Write discussion on Why we need to use a while statement when using wait method
Your posts are moderated
Related Questions
Extend task 1 so that the requests are issued by the clients instead of the server. The server now do not use the "all_requests.dat" file. Instead every client thread reads from

How can the deadlock be prevented-Safe State Safe state : A state is safe if the system is able to allocate resources to each process in some order and still avoid deadlock.

Question : (a) In the demand paging system, when a process tries to access a page that was not brought into memory, a page fault occurs that involves a series of actions. The

Usually memory is allocated from a large pool of unused memory area called the heap. In C++, dynamic allocation/deallocation must be manually performed using commands like malloc,

What are kernels and what do kernels do? The kernel is a program that comprises the central core of a computer operating   system. It has entire control over everything that

Problem: (a) Based on your experience in setting up Windows 2003 Server operating system, briefly describe the twelve different steps in which the installation is conducted du

Q. In a ring-protection system the level 0 has the greatest access to objects and level n (greater than zero) has fewer access rights. The access rights of a program at a partic

Q. Why might a system utilize interrupt-driven I/O to manage a single serial port however polling I/O to manage a front-end processor such as a terminal concentrator? A

Question 1 What is a file? Write down the operations on files Question 2 What do you mean virtual machine? Write down the application of virtual machine Question 3 What

What problems arise if the directory structure is a general graph? Searching for a particular file may result in searching the similar directory many times. Deletion of the fil