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
At the end of this lecture, and into the next lecture, we will discuss the last major type of logical error that can occurwhen programming with threads. A deadlock occurswhen two t

Overlay structured program: A program consisting of overlays is referred as overlay structured program in which an overlay is a part of program which has similar load origin as

Explain the Resource Ownership by Platform Ownership of data items may further be complicated by concepts defined in certain operating systems. Each operating system defines "p

1. A digitized voice channel is made by digitizing a 7 KHz bandwidth analog signal. The signal is to be sampled twice the highest frequency (two samples per hertz) . Assume each sa

The objects that a program can access directly are those objects which are referenced by local vari-ables on the processor stack, or by any global/static variables that refer to ob

Show the search tree generated by Hill-Climbing search (text figure 4.2, page 122; or Local Search lecture, slide 6) for each of the two heuristics (a) and (b) applied to the follo

The following information is available for three MPS (Master Product Scheduling) items: Product A                            An 80 unit order is to be started in Week 3.

explain in detail about ipc in linux

Direct memory access Many computers avoid burdening the main CPU with programmed I/O by offloading sine if this work to a special-purpose processor known as a direct memory add

how fat file system is organised