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
IMPLEMENTATION OF SEGMENTATION WITH AN EXAMPLE Segmentation is a memory-management scheme that represents the user view of memory. A logical address space is the collection of


Define where a Program generation activity aimsĀ  Program generation activity aims at Automatic generation of program

Q. What is the major difficulty that a programmer should overcome in writing an operating system for a real-time environment? Answer: The major difficulty is keeping the oper

Processes and threads each have their place in multi-programming, generally to hide latency and to maximize CPU utilization. With the continuing spread of multi-core processors in

Write a XML with database with book details (BOOK ID, Title, Author, subject, publisher year, language, vendor, and price)

What does it mean for something to be thread-safe? By saying that X is thread-safe, we mean that if multiple threads use X at the same time, we don't have to worry about concurrenc

FIFO page replacement This is the easiest page replacement algorithm. At this juncture the 1 st page entering is the 1 st to leave that is the oldest page leaves. To execute

What are the three main activities of an operating system in regard to secondary-storage management? a) Free-space management. b) Storage allocation. c) Disk scheduling.

The different paging techniques are 1. Multilevel paging or hierarchical paging method: In definite cases the page table may consist up to 1 million entries. This would be