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
What is a Process Control Block? Every process in the operating system is represented by a process control block as well called a task control block. It contains several pieces

You have been requested by your Senior Engineer to design an Engine Control Unit (ECU) and prepare a report detailing your proposed solution. The client requires a design for a mic

How can the deadlock be prevented-Safe State Safe state : A state is safe if the system is able to allocate resources to each process in some order and still avoid deadlock.

Inverted page table In page table the page table has one entry for every page that the process is using. The operating system must translate this reference into a physical memo

what is cpu

Write a note about Directory structure with examples. The FreeBSD directory hierarchy is basic to obtaining an overall understanding of the system. The most significan

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

Define the Scheduling in Multitasking Earlier we learned the concepts and advantages of multitasking. In a system in which one or more tasks( threads or processes) attempt to s

Question: (a) The following table (table 1.0) gives the length of the CPU burst time in milliseconds of processes P 1 to P 4 . Assume the processes arrived in the order P 1 ,

Using pages makes it easier to manage the whole memory, avoiding excessive fragmentation and waste. As an analogy, think of Tetris, but with only square blocks: it is relatively ea