cmpt300 - Due date April21 11:59 P.M 1 What is...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
<Exercise 2> Due date: April21, 11:59 P.M. 1. What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answer. Busy waiting means that a process is waiting for a condition to be satisfied in a tight loop without relinquish the processor. Alternatively, a process could wait by relinquishing the processor, and block on a condition and wait to be awakened at some appropriate time in the future. Busy waiting can be avoided but incurs the overhead associated with putting a process to sleep and having to wake it up when the appropriate program state is reached. 2. Solve the dining philosopher’s problem using monitors instead of semaphores. CONCEPT: A number of philosophers sits forever around a circular table. In the center of the table is a bowl of rice. Between each two philosophers is a shared chopstick. Each philosopher spends his/her life alternating between thinking and eating. When a philosopher gets hungry, he/she must gain exclusive access to both chopsticks before eating. We seek a mechanism that provides the necessary synchronization and meets the usual requirements of progress (efficiency), freedom from deadlock, and bounded waiting (fairness). A monitor is used to control access to state variables and condition variables. The chopsticks themselves are not part of the monitor (nor is the rice). If they were, then the entire act of eating would have to be a monitor procedure and only one philosopher could eat at a time. Monitor procedures are defined for the actions of obtaining the chopsticks and putting them down. These are used as entry and exit
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2009 for the course CS CMPT 300 taught by Professor Bradbart during the Spring '09 term at Simon Fraser.

Page1 / 5

cmpt300 - Due date April21 11:59 P.M 1 What is...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online