Why we need to use a while statement when using wait method, Operating System

Assignment Help:

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.


Related Discussions:- Why we need to use a while statement when using wait method

Subject: system analysis (2000 word), Overview: In this assignment, you are...

Overview: In this assignment, you are going to perform a system analysis and design of a membership and facility management system of a gymnasium of given case study Task: You are

Explain optimal page replacement, Optimal page replacement An optimal ...

Optimal page replacement An optimal page replacement algorithm has the least page fault rate of all algorithms. The algorithm states that a 'replace the page that will not be

Semaphore, mention the three problems that mat be caused by wrong initializ...

mention the three problems that mat be caused by wrong initialization and placement of wait() and signal()operations in the use of semaphore

Define different multithreading models, DIFFERENT MULTITHREADING MODELS ...

DIFFERENT MULTITHREADING MODELS Multithreading Models the majority multithreading models fall into one of the following categories of threading implementation: 1.      M

Define disadvantages of top down parsing of backtracking, Define Disadvanta...

Define Disadvantages of Top Down parsing of Backtracking The disadvantages of top down parsing of backtracking: (i)  Semantic actions cannot be carried out while making a pr

MULTITASKING, EXPLAIN MULTITASKING IN DETAIL

EXPLAIN MULTITASKING IN DETAIL

Definition of operating system, Q. Definition of Operating System? Defi...

Q. Definition of Operating System? Definition of Operating System: • An Operating system is a program which controls execution of application programs and acts as an interfa

Define unix device driver, Define UNIX device driver The UNIX device dr...

Define UNIX device driver The UNIX device driver is structured into two halves called top half and bottom half

Distinguish between long and short term scheduler, Question 1: a) Disti...

Question 1: a) Distinguish between "Long-Term Scheduler" and "Short-Term Scheduler". b) Describe the benefits of "Threads". c) Name three types of CPU Scheduling. Que

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd