Lecture28 - Quiz #2 is due now Project #4 Monday, June 1 Do...

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

View Full Document Right Arrow Icon
Monday, June 1 Monday, June 1 Quiz #2 is due now Quiz #2 is due now Project #4 Project #4 Due Wednesday, June 3 before midnight Due Wednesday, June 3 before midnight Evaluation criteria are posted Evaluation criteria are posted Questions / Comments? Questions / Comments? Do the  Do the  Projects Survey Projects Survey Contribution credit Contribution credit Responses (only 3 so far) are posted on the  Responses (only 3 so far) are posted on the  course wiki course wiki Verify your scores! Verify your scores!
Background image of page 1

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

View Full DocumentRight Arrow Icon
Today’s topics Today’s topics More Synchronization More Synchronization
Background image of page 2
The Critical-Section Problem Suppose we have  n   processes all using  some shared data Each process has a  critical section   code segment in which the shared data is  accessed Problem:  How to ensure that when one  process is executing in its critical section,  no other process is allowed to execute its  critical section.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Structure of a Cooperating Process do { /* entry section : request exclusive use of CPU */ /* critical section : no other process in the cooperating set can be in its critical section */ /* exit section : yields CPU */ /* remainder section : other non-critical code */ } while (1);
Background image of page 4
Requirements for a Solution  to Critical-Section Problem 1. Mutual Exclusion . if   a process  P i   is executing in its critical  section  then no other process in the cooperating  set can be executing in its critical  section
Background image of page 5

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

View Full DocumentRight Arrow Icon
Requirements for a Solution  to Critical-Section Problem 2. Progress . if A. no process is executing in its critical  section, and  B. there are processes ready to enter their  critical sections then the next process to enter its critical  section must be selected only from  processes that are not in their  remainder sections, and the selection  cannot be postponed indefinitely.
Background image of page 6
Requirements for a Solution  to Critical-Section Problem 3. Bounded Waiting . Between the  time that process has made  a request  to execute its critical section  and the  time the request is granted  …  there must be a limit to the number of  times that other processes may enter  their critical sections
Background image of page 7

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

View Full DocumentRight Arrow Icon
Too much milk “Classical” simple problem of synchronization Many possible configurations.  Origin ?? Time PersonA PersonB 4:00 Check fridge.  Out of milk 4:05 Leave for supermarket 4:10 travelling Check fridge.  Out of milk 4:15 Arrive at supermarket Leave for convenience store 4:20 Buy milk.  Leave supermarket Arrive at convenience store 4:25 travelling Buy milk.  Leave convenience  store 4:30 Arrive home.  Put milk in fridge Arrive home.  Put milk in fridge
Background image of page 8
Too much milk Probably half of the milk will spoil.  (Solution is not correct.) What do we mean by “correct”?
Background image of page 9

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

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

Page1 / 42

Lecture28 - Quiz #2 is due now Project #4 Monday, June 1 Do...

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

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