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
Allocators can also be used to avoid problems with unsafe languages. C and C++ are pervasive, with huge amounts of existing code. They are also memory-unsafe languages, in that the

Q. Consider the two-dimensional array A: int A[][] = new int[100][100]; Whereas A [0][0] is at location 200 in a paged memory system with pages of size 200. A little process

What is an operating system? An operating system is a program that manages the computer hardware. It acts as an intermediate among users of a computer and the computer hardware

WHAT IS OPERATING SYSTEM ?ENLIST AND EXPLAIN BASIC SERVICES PROVIDE BY OS

Determine a processing that is not a part of Synthesis phase  Perform LC processing is not a part of Synthesis phase

Software for business management integrated into a social network Project Description: We are seeking top professionals to build software with us that manages the business.

Define a program in execution is known as A program in execution is known as a process

Define the Global vs. local variables It is also important to discuss the scope of resources being granted to the application program.  Variable scoping is defined as the acces

Producer-Consumer Problem Using Semaphores The Solution to producer-consumer problem use three semaphores namely- full, empty and mutex. The semaphore 'full' is utilized for

Explain in detail about ipc in linux