Critical Region Classical OS Problems - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Critical Region Classical OS Problems

Description:

Questions over homework #2??? Return Quick Check from Thursday, Jan 25. Sec 2.3 ... Lockstep Alternation (ALMOST) Violates 3rd rule of Critical Regions ... – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 16
Provided by: kna4
Category:

less

Transcript and Presenter's Notes

Title: Critical Region Classical OS Problems


1
Critical RegionClassical O/S Problems
  • Ch 2.3 and 2.4
  • Tuesday, January 30, 2007

2
Todays Schedule
  • Questions over homework 2???
  • Return Quick Check from Thursday, Jan 25
  • Sec 2.3 Critical Regions
  • Ch 2.4 Design Issues for O/S
  • Mutual exclusion
  • Dining Philosophers Problem
  • Tuesday, February 6 - Test 1
  • Ch 1
  • Ch 2 (2.1 2.4)

3
Objectives
  • Recognize need for Mutual Exclusion in the design
    of operating systems
  • Identify software and hardware techniques for
    protecting critical regions, and compare between
    the methods
  • Experience the complexity in guaranteeing mutual
    exclusion among processes competing for the same
    resources

4
Interprocess CommunicationRace Conditions
  • Two processes want to access shared memory at
    same time

5
Critical Regions (2)
  • Mutual exclusion using critical regions

6
IPC Basics
  • Race Conditions
  • Critical Region
  • One at a Time
  • Speed Independent
  • Non-Critical Regions Immaterial
  • Finite Waiting
  • Solution?
  • Mutual Exclusion

7
Basic Mutual Exclusion
  • Disable Interrupts (BAD!)
  • Only works for one Processor
  • User must remember to re-enable interrupts
  • Lock Variable (GETTING CLOSER)
  • How do you lock the lock?
  • Lockstep Alternation (ALMOST)
  • Violates 3rd rule of Critical Regions

8
Basic Mutual Exclusion (cont.)
  • Interested Flags (Petersons Solution)
  • Test Set
  • Atomic Action
  • Read Value to see locked
  • Automatically set to locked, just in case
  • Sleep Wakeup

9
Review Critical Regions
  • Four conditions to provide mutual exclusion
  • No two processes simultaneously in critical
    region
  • No assumptions made about speeds or numbers of
    CPUs
  • No process running outside its critical region
    may block another process
  • No process must wait forever to enter its
    critical region

10
Mutual Exclusion with Busy Waiting (1)
  • Proposed solution to critical region problem
  • (a) Process 0. (b) Process 1.

11
Mutual Exclusion with Busy Waiting (2)
  • Peterson's solution for achieving mutual exclusion

12
IPC (Dining Philosophers)
  • Multiple processes attempting to obtain multiple
    resources
  • Not enough resources to satisfy all requests at
    all times (Wait necessary)
  • Why is this relevant?

13
Dining Philosophers Demonstration
14
Philosopher Resolution?
  • Patterned locking?
  • Take left, then take right?
  • Locking the entire find fork area?
  • Steal your forks while no one else can
  • State Array?
  • Track who has forks, who is waiting

15
Thursday, February 1
  • Continue Reading Chapter 2.3 Monitors,
    Semaphores, Readers Writers pg 108-115, pg
    123-129
  • Bring questions from Ch 1 and 2
  • Test 1 on Tuesday, Feb 6
Write a Comment
User Comments (0)
About PowerShow.com