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
Your task is to replace the round robin CPU scheduling scheme you developed in Practical 6 with a priority-based scheduling algorithm. To simplify matters, you can maintain the ori

Define UnixWare UnixWare manages resources at the process level. Each resource allocated to the application is actually allocated to the process representing the application. C

Why Global variables are unacceptable Global variable, for instance, are unacceptable because they break the rules of self - containment. If all procedural components are runni

Q. What are the advantages as well as disadvantages of using circuit switching? For what types of applications is circuit switching a viable strategy? Answer: Circuit

MEMORY MANAGEMENT USING BIT MAPS   In this memory is separated into different allocation units each of some particular size(a few bites).consider every space of size 4k. A

Q. Why High level languages need Compiler? High level languages - illustrations are COBOL, FORTRAN, PL/I andALGOL - are processed by interpreters andcompilers. A compilers is a

Explain how protection is provided for the hardware resources by the operating system. Dual mode operation Sharing system resources needs operating system to make sure


Q. What system calls have to be implementing by a command interpreter or shell in order to start a new process? Answer: In the UNIX systems a fork system call followed by an ex

Q. What are the five main activities of an operating system in regard to process management? Answer: a. The creation as well as deletion of both user and system processes