• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Kcd226 Sistem Operasi Lecture04
 

Kcd226 Sistem Operasi Lecture04

on

  • 576 views

 

Statistics

Views

Total Views
576
Views on SlideShare
576
Embed Views
0

Actions

Likes
0
Downloads
13
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Kcd226 Sistem Operasi Lecture04 Kcd226 Sistem Operasi Lecture04 Presentation Transcript

    • Lecture 4 Interprocess and Scheduling 4.1. Interprocess communication 4.2. Classical IPC problems 4.3. Scheduling Sistem Operasi http://fasilkom.narotama.ac.id/ 1
    • Interprocess Communication Race Conditions Two processes want to access shared memory at same time Sistem Operasi http://fasilkom.narotama.ac.id/ 2
    • Critical Regions (1) Four conditions to provide mutual exclusion 1. No two processes simultaneously in critical region 2. No assumptions made about speeds or numbers of CPUs 3. No process running outside its critical region may block another process 4. No process must wait forever to enter its critical region Sistem Operasi http://fasilkom.narotama.ac.id/ 3
    • Critical Regions (2) Mutual exclusion using critical regions Sistem Operasi http://fasilkom.narotama.ac.id/ 4
    • Mutual Exclusion with Busy Waiting (1) Proposed solution to critical region problem (a) Process 0. Sistem Operasi (b) Process 1. http://fasilkom.narotama.ac.id/ 5
    • Mutual Exclusion with Busy Waiting (2) Sistem Operasi http://fasilkom.narotama.ac.id/ Peterson's solution for achieving mutual exclusion 6
    • Mutual Exclusion with Busy Waiting (3) Entering and leaving a critical region using the Sistem Operasi TSL instruction http://fasilkom.narotama.ac.id/ 7
    • Sleep and Wakeup Producer-consumer http://fasilkom.narotama.ac.id/ fatal race condition8 Sistem Operasi problem with
    • Semaphores TheSistem Operasi http://fasilkom.narotama.ac.id/ producer-consumer problem using semaphores 9
    • Mutexes Implementation of mutex_lock and mutex_unlock Sistem Operasi http://fasilkom.narotama.ac.id/ 10
    • Monitors (1) Sistem Operasi Example of a monitor http://fasilkom.narotama.ac.id/ 11
    • Monitors (2) • Outline of producer-consumer problem with monitors – only one monitor procedure active at one time Sistem Operasi http://fasilkom.narotama.ac.id/ – buffer has N slots 12
    • Monitors (3) Solution to producer-consumer problem in Java (part 1) Sistem Operasi http://fasilkom.narotama.ac.id/ 13
    • Monitors (4) Solution to producer-consumer problem in Java (part 2) Sistem Operasi http://fasilkom.narotama.ac.id/ 14
    • Message Passing The producer-consumer problem with N messages Sistem Operasi http://fasilkom.narotama.ac.id/ 15
    • Barriers • Use of a barrier – processes approaching a barrier – all processes but one blocked at barrier Sistem Operasi http://fasilkom.narotama.ac.id/ – last process arrives, all are let through 16
    • Dining Philosophers (1) • Philosophers eat/think • Eating needs 2 forks • Pick one fork at a time • How to prevent deadlock Sistem Operasi http://fasilkom.narotama.ac.id/ 17
    • Dining Philosophers (2) A nonsolution to the dining philosophers problem Sistem Operasi http://fasilkom.narotama.ac.id/ 18
    • Dining Philosophers (3) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to dining philosophers problem (part 1) 19
    • Dining Philosophers (4) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to dining philosophers problem (part 2) 20
    • The Readers and Writers Problem A solution to the readers and writers problem Sistem Operasi http://fasilkom.narotama.ac.id/ 21
    • The Sleeping Barber Problem (1) Sistem Operasi http://fasilkom.narotama.ac.id/ 22
    • The Sleeping Barber Problem (2) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to sleeping barber problem. 23
    • Scheduling Introduction to Scheduling (1) • Bursts of CPU usage alternate with periods of I/O wait – a CPU-bound process – an I/O bound process Sistem Operasi http://fasilkom.narotama.ac.id/ 24
    • Introduction to Scheduling (2) Sistem Operasi Scheduling Algorithm Goals http://fasilkom.narotama.ac.id/ 25
    • Scheduling in Batch Systems (1) An example of shortest job first scheduling Sistem Operasi http://fasilkom.narotama.ac.id/ 26
    • Scheduling in Batch Systems (2) Sistem Operasi Three level scheduling http://fasilkom.narotama.ac.id/ 27
    • Scheduling in Interactive Systems (1) • Round Robin Scheduling – list of runnable processes – list of runnable processes after B uses up its quantum Sistem Operasi http://fasilkom.narotama.ac.id/ 28
    • Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes Sistem Operasi http://fasilkom.narotama.ac.id/ 29
    • Scheduling in Real-Time Systems Schedulable real-time system • Given – m periodic events – event i occurs within period Pi and requires Ci seconds • Then the load can only be handled if m Ci ∑ P ≤1 i =1 Sistem Operasi i http://fasilkom.narotama.ac.id/ 30
    • Policy versus Mechanism • Separate what is allowed to be done with how it is done – a process knows which of its children threads are important and need priority • Scheduling algorithm parameterized – mechanism in the kernel • Parameters filled in by user processes – policy set by user process Sistem Operasi http://fasilkom.narotama.ac.id/ 31
    • Thread Scheduling (1) Possible scheduling of user-level threads • 50-msec process quantum • threads run http://fasilkom.narotama.ac.id/ Sistem Operasi 5 msec/CPU burst 32
    • Thread Scheduling (2) Possible scheduling of kernel-level threads • 50-msec process quantum • threads run http://fasilkom.narotama.ac.id/ Sistem Operasi 5 msec/CPU burst 33
    • Question ? Sistem Operasi http://fasilkom.narotama.ac.id/ 34