DOC PREVIEW
U of I CS 241 - CPU Scheduling (3)

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS241 Operating Systems CPU Scheduling (3)ContentAdministrative NotesShortest Job First (SJF)Non-preemptive SJF: ExampleComparing to FCFSSJF is not always optimalPreemptive SJFPreemptive SJF: Same ExampleA Problem with SJFInteractive Scheduling AlgorithmsMulti-Queue SchedulingMulti-Queue Scheduling: ExampleReal-Time SchedulingPriority Inversion and InheritanceUser-level Thread SchedulingKernel-level Thread SchedulingIntroduction to Signals (Ch8 pp255-283)Introduction to Signals (2)POSIX Required Signals (1)POSIX Required Signals (2)Generating SignalsProgramming a signal (1)Programming a signal (2) (A process sends a signal to itself)SummaryCS241 Operating SystemsCPU Scheduling (3)Klara NahrstedtLecture 122/15/200601/14/19 CS 241 - System Programming, Klara Nahrstedt2ContentScheduling algorithms–Batch systemsShortest job first–Interactive systemsMulti QueueReal-Time SchedulingThread Scheduling Introduction to SignalsSummary01/14/19 CS 241 - System Programming, Klara Nahrstedt3Administrative NotesMP2 on scheduling is runningQuiz 3 will be on Friday, February 17, 2006Quiz 3 will include material from Tanenbaum, 3rd edition, section 2.2, 2.3, 2.4 AND LECTURE NOTES (see lecture note files)–lec6-syn1–lec7-syn2–lec8-syn3–lec8-syn4–lec10-sched–lec11-sched01/14/19 CS 241 - System Programming, Klara Nahrstedt4Shortest Job First (SJF)Schedule the job with the shortest elapse time firstScheduling in Batch Systems Two types:–Non-preemptive–PreemptiveRequirement: the elapse time needs to be known in advanceOptimal if all jobs are available simultaneously (provable) –Gives the best possible AWT (average waiting time)01/14/19 CS 241 - System Programming, Klara Nahrstedt5Non-preemptive SJF: ExampleProcess Duration Order Arrival TimeP1 6 1 0P2 8 2 0P3 7 3 0P4 3 4 003P4 (3)P1 (6)9P3 (7)16P4 waiting time: 0P1 waiting time: 3P3 waiting time: 9P2 waiting time: 16The total time is: 24The average waiting time (AWT): (0+3+9+16)/4 = 7P2 (8)2401/14/19 CS 241 - System Programming, Klara Nahrstedt6Comparing to FCFSProcess Duration Order Arrival TimeP1 6 1 0P2 8 2 0P3 7 3 0P4 3 4 006P4 (3)P1 (6)14P3 (7)21P1 waiting time: 0P2 waiting time: 6P3 waiting time: 14P4 waiting time: 21The total time is the same.The average waiting time (AWT): (0+6+14+21)/4 = 10.25(comparing to 7)P2 (8)2401/14/19 CS 241 - System Programming, Klara Nahrstedt7SJF is not always optimalIs SJF optimal if all the jobs are not available simultaneously?Process Duration Order Arrival TimeP1 10 1 0P2 2 2 20 10P1 (10)P1 waiting time: 0P2 waiting time: 8The average waiting time (AWT): (0+8)/2 = 4P2 (2)2 (p2 arrives) 1201/14/19 CS 241 - System Programming, Klara Nahrstedt8Preemptive SJFAlso called Shortest Remaining Time First–Schedule the job with the shortest remaining time required to completeRequirement: the elapse time needs to be known in advance01/14/19 CS 241 - System Programming, Klara Nahrstedt9Preemptive SJF: Same ExampleProcess Duration Order Arrival TimeP1 10 1 0P2 2 2 2P1 waiting time: 4-2 =2P2 waiting time: 0The average waiting time (AWT): (0+2)/2 = 1No CPU waste!!!0122 P1 (8)P2 (2)4P1 (2)01/14/19 CS 241 - System Programming, Klara Nahrstedt10A Problem with SJFStarvation–In some condition, a job is waiting for ever–Example: SJFProcess A with elapse time of 1 hour arrives at time 0But ever 1 minute, a short process with elapse time of 2 minutes arriveResult of SJF: A never gets to run01/14/19 CS 241 - System Programming, Klara Nahrstedt11Interactive Scheduling AlgorithmsUsually preemptive–Time is sliced into quantum (time intervals)–Scheduling decision is also made at the beginning of each quantumPerformance Criteria–Min Response time–best proportionality Representative algorithms:–Priority-based–Round-robin–Multi Queue & Multi-level Feedback–Shortest process time–Guaranteed Scheduling–Lottery Scheduling–Fair Sharing Scheduling01/14/19 CS 241 - System Programming, Klara Nahrstedt12Multi-Queue SchedulingHybrid between priority and round-robinProcesses assigned to one queue permanently Scheduling between queues –Fixed Priorities –% CPU spent on queue Example –System processes –Interactive programs –Background Processes –Student Processes Address the starvation and infinite blocking problems01/14/19 CS 241 - System Programming, Klara Nahrstedt13Multi-Queue Scheduling: Example20%50%30%01/14/19 CS 241 - System Programming, Klara Nahrstedt14Real-Time SchedulingHard-Real Time v Soft-Real TimePeriodic vs AperiodicA set of m periodic event streams is schedulable if the condition ∑Ci/Pi ≤ 1 is satisfied, where i=1,…,m; Ci is the processing CPU time of an event stream i; Pi is the period at which the event i occursIf the set of event streams are schedulable then the real-time scheduling policy Earliest Deadline First worksImplementation of the scheduling policy: Earliest Deadline process is mapped to the highest priority01/14/19 CS 241 - System Programming, Klara Nahrstedt15Priority Inversion and InheritancePriority inversion –When a higher priority process needs to read or modify kernel data that are currently being accessed by a lower priority process. –The higher priority process must wait!– But the lower priority cannot proceed quickly due to scheduling.Solution: priority inheritance (Result of Prof. Sha, Rajkumar and Lehotzky Work)–When a lower-priority process accesses a resource, it inherits the priority level of the waiting high-priority process until it is done with the resource in question. And then its priority reverses to its natural value.01/14/19 CS 241 - System Programming, Klara Nahrstedt16User-level Thread SchedulingPossible Scheduling 50-msec process quantumrun 5 msec/CPU burst01/14/19 CS 241 - System Programming, Klara Nahrstedt17Kernel-level Thread SchedulingPossible scheduling 50-msec process quantumthreads run 5 msec/CPU burst01/14/19 CS 241 - System Programming, Klara Nahrstedt18Introduction to Signals (Ch8 pp255-283)Signal is a software notification to a process of an event.–Examples of such events Process waits on a semaphoreProcess waits to be scheduledA signal is generated when the event that causes the signal occurs. A signal is delivered when the process takes action based on the signal. The lifetime of a signal is the interval between its generation and delivery. A signal that has been


View Full Document

U of I CS 241 - CPU Scheduling (3)

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download CPU Scheduling (3)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CPU Scheduling (3) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CPU Scheduling (3) 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?