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
What are the various process scheduling concepts? a) Scheduling queues with diagram b) Queuing diagram c) Schedulers d) Context switch with diagram

Swapping : Whole process is moved from the swap machine to the main memory for execution. Process size must be equal or less than to the used main memory. It is easier to exe

When we download a movie from the Internet, we don't care about, say, packet sizes. However, even ifwe are not aware of howlow-level details of networks are implemented, our data i

What components of the R/e system initiate the start of background jobs at the specified time? The batch scheduler initiates the begin of background job.  The dispatcher then s

Multithreading - Operating systems that permit different parts of a software program to run concurrently. Operating systems that would come into this category are: Linux UNI

In which page replacement policy Balady’s anomaly occurs? FIFO (First in First Out)

Explain the TlsSetValue (TLSindex, dataPtr)Function The TlsSetValue function  associates the  dataPtr passed as a parameter as local storage for the requesting thread. The asso

OPERATING SYSTEM 1. Describe the term operating system. Write down the functions of operating system. 2. Explain Thread? Write down the advantages and disadvantages of threa

Explain Deadlock Prevention-Resource allocation graph allocation Resource allocation graph algorithm :  Using this algorithm we are able to actually know if there exists in th

Determine the equation for the y and truth table for the circuits