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
For the first assignment you are required to construct a logic circuit onto a copper clad circuit board (vero board). This construction will require the use of planning the positio

Question: a) Each process is represented in the operating system by a process control block (PCB). The PCB contains many pieces of information associated with a specific proce

Explain segmentation hardware? We define an completion to map two-dimensional user-defined addresses into one-dimensional physical addresses. This mapping is affected by means

The optimal replacement policy, called OPT, is to evict the page which will be accessed farthest into the future. Since we can't predict the future precisely, we can't implement OP

Write a note on multithreading. Multithreading is the capability of an operating system to execute different parts of a program called as threads, at the same time. The program

p0A B C D A B C D A B C D 2 0 12 2012 1000 1354 0632 0014

Explain external fragmentation? External fragmentation is the process where the free space and the space still available for use, in a piece of storage become separated into ma

When the Page fault frequency in an operating system is reduced Locality of reference is appropriate to the process

Write a script that uses this idea to print output similar to the following: Files in this directory that match *~ : bash-scripts.html~ chimpanzee~ countdown~ countd

The question of fairness, regarding page eviction, is a hard one. How do we decide what is fair? Many operating systems use global LRU, where pages from all processes are managed t