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
BEST FIT ALGORITHM Here scanning is for the finest fit one. Signifies it searches the entire list for the best fit position. For the process therefore in that the process will

Explain briefly the working of semaphore with example ? The E.W. Dijkstra (1965) abstracted the key idea of mutual exclusion in his concepts of semaphores. Definition A s

THE PROGRAM WILL CHOOSE TWO RANDOM NUMBERS,THEN PRINT THEM OUT AS AN ADDITION PROBLEM.THE PROGRAM WILL THEN ASK THE USERTO ENTER THE CORRECT ANSWER.IF THE ANSWER IS CORRECT,THE PRO

Contiguous allocation The contiguous-allocation method needs each file to occupy a set of contiguous blocks of the disk. Disk addresses explain a linear ordering on the disk. T


Describe swapping technique in UNIX systems. Swapping is used to control memory contention among processes. If there is excessively much memory contention, processes are swappe

Q. Operating System as User Interface? • Every general purpose computer comprises the operating system, hardware, system programs and application programs. The hardware compris

Define Ageing Ageing is a method of enhancing the priority of process waiting in Queue for CPU allocation

What is Multiprogramming? Multiprogramming is the capability of am operating system to support multiple applications running concurrently. Multiprogramming simply means that an

Ask question Project Details PROJECT OVERVIEW The ABC Hospital is upgrading their version of Windows. As part of the upgrade, 100 new computers will be purchased. Your task is to