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

What are scheduling queues?, What are scheduling queues? Since the proc...

What are scheduling queues? Since the processes enter the system they are put into job queue. This queue contains all processes in the system. The processes that are exist in m

What are the benefits of multithreaded programming, What are the benefits o...

What are the benefits of multithreaded programming? The advantages of multithreaded programming can be broken down into four main categories: Responsiveness Resourc

What is virtual file system?, What is virtual file system? A Virtual f...

What is virtual file system? A Virtual file system switch (VFS) or Virtual file system is an abstraction layer   on top of a more concrete file system. The purpose of a VFS

Mention some attractive properties of semaphore?, Mention some attractive p...

Mention some attractive properties of semaphore?              The Semaphores aren't provided by hardware. However they have numerous attractive properties: Machine indep

What is co-operative process, What is co-operative process? A process i...

What is co-operative process? A process is co-operating if it can influence or be affected by the other processes implementing in the system. Any process that share data with o

What is multiprogramming?, What is multiprogramming? Multiprogramming: ...

What is multiprogramming? Multiprogramming: The management of many processes within a single processor system. Operating systems such like UNIX provide multiprogramming for sha

Explain gui based operating system, GUI - Short for Graphical User Interfa...

GUI - Short for Graphical User Interface a GUI Operating System contains icons and graphics and is commonly navigated by using a computer mouse. Below are some instances of GUI Op

Explain lru additional reference bits algorithm, Additional Reference bits...

Additional Reference bits algorithm Here we keep an 8-bit byte for every page in memory. At standard intervals the reference bit is shifted by the OS. If a shift register conta

Why system calls have to be implementing by a interpreter, Q. What system c...

Q. What system calls have to be implementing by a command interpreter or shell in order to start a new process? Answer: In the UNIX systems a fork system call followed by an ex

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