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
Device Drivers Communicates straight with peripheral devices (disks, tapes, etc.). Responsible for begin physical I/O operations on the device. Pro

Q. Describe why SSTF scheduling tends to favour middle cylinders over the innermost and outermost cylinders. Answer: The middle of the disk is the location having the smalles

Q.  What kind of operating system is Windows XP? Describe two of its major features. Answer: A 32 or 64 bit pre-emptive multitasking operating system supporting multiple use

#question.explain varios types of system calls..

Explain what ISAM is. Indexed sequential access method. The file is stored in sorted order. ISAM has a master index file, indicating in what part of another index file the key

Q. Explain about Functions of Operating System? Functions of Operating System Operating system performs 3 functions as follows: 1.  Convenience:   Operating System mak

Ask question #Minimum 100 words accepteWrite an xeyes command to display a window that is: ? SIZE: ¦ 400 pixels wide ¦ 300 pixels tall ? LOCATION: ¦ 100 pixels from the right edge

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

Determine how Action implementing instruction’s meaning are a actually carried out   Action implementing meaning of instruction are a actually carried out Instruction executio

How is a process chosen for being swapped either in or out? Swap out: a.         If the process is idle. b.         If process has been in main memory for a long time.