DOC PREVIEW
U of I CS 241 - Lecture 11

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 System Programming CPU Scheduling (2)ContentAdministrativePreemptive vs. Non-preemptiveWhat are the scheduling objectives?Scheduling ObjectivesPerformance CriteriaDifferent Systems, Different FocusesProcess ProfilesProgram Behaviors Considered in SchedulingCPU SchedulerDispatcherSingle Processor Scheduling AlgorithmsFirst Come First Serve (FCFS) (Batch Scheduling Policy)FCFS ExampleProblems with FCFSFCFS PerformanceConvoy EffectsPriority Scheduling (Interactive Scheduling Policy)Set PriorityPriority Scheduling: ExampleRound-robin (Interactive Scheduling Policy)Round-robin: ExampleTime QuantumSummaryCS241 System Programming CPU Scheduling (2)Klara NahrstedtLecture 112/13/200601/14/19 CS 241 - System Programming,Klara Nahrstedt2ContentBasic Scheduling Algorithm (FCFS)Round RobinPriority SchedulingSummary01/14/19 CS 241 - System Programming,Klara Nahrstedt3AdministrativeMP2 posted today, due February 27MP1 due today, February 13Read T: 2.4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 Nahrstedt4Preemptive vs. Non-preemptiveNon-preemptive scheduling:–The running process keeps the CPU until it voluntarily gives up the CPU process exitsswitches to blocked state1and 4 only (no 3)Preemptive scheduling:–The running process can be interrupted and must release the CPU (can be forced to give up CPU)RunningTerminatedReady Blocked14301/14/19 CS 241 - System Programming,Klara Nahrstedt5What are the scheduling objectives?(CPU (horsepower))Process 1Process 2 Process 3I want to ride itWhose turn is it?01/14/19 CS 241 - System Programming,Klara Nahrstedt6Scheduling ObjectivesFair (nobody cries)Priority (lady first)Efficiency (make best use of equipment)Encourage good behavior (good boy/girl)Support heavy loads (degrade gracefully)Adapt to different environments (interactive, real-time, multi-media)01/14/19 CS 241 - System Programming,Klara Nahrstedt7Performance CriteriaFairness Efficiency: keep resources as busy as possible Throughput: # of processes that completes in unit time Turnaround Time (also called elapse time)–amount of time to execute a particular process from the time its entered Waiting Time –amount of time process has been waiting in ready queue Response Time –amount of time from when a request was first submitted until first response is produced. –predictability and variance Policy Enforcement:– seeing that stated policy is carried out Proportionality: –meet users' expectation Meeting Deadlines: avoid losing data01/14/19 CS 241 - System Programming,Klara Nahrstedt8Different Systems, Different FocusesFor all–Fairness, policy enforcement, resource balanceBatch Systems–Max throughput, min turnaround time, max CPU utilization Interactive Systems–Min Response time, best proportionality Real-Time Systems–predictability, meeting deadlines01/14/19 CS 241 - System Programming,Klara Nahrstedt9Process ProfilesI/O – Bound –Does too much I/O to keep CPU busyCPU – Bound–Does too much computation to keep I/O busyProcess Mix–Scheduling should load balance between I/O bound and CPU-bound processes–Ideal would be to run all equipment at 100% utilization but that would not necessarily be good for response time01/14/19 CS 241 - System Programming,Klara Nahrstedt10Program Behaviors Considered in SchedulingIs it I/O bound? Example?Is it CPU bound? Example?Batch or interactive environment Urgency Priority Frequency of page faults Frequency of preemption How much execution time it has already received How much execution time it needs to complete compute computeI/OI/O I/O01/14/19 CS 241 - System Programming,Klara Nahrstedt11CPU SchedulerProc 1: 14 time unitsProc2: 8 time unitsProc3: 8 time unitsDispatcherPreemptive vs.non-preemptiveReady queueProc 1Proc 2Proc 3Proc 10Proc 11Proc 12blocked queueCPUDispatcher01/14/19 CS 241 - System Programming,Klara Nahrstedt12DispatcherGives the control of the CPU to the process, scheduled by the short-term scheduler. Functions: –switching context–switching to user mode–jumping to the proper location in the user program. Dispatch Latency :time to stop process and start another one. –Pure overhead–Needs to be fast01/14/19 CS 241 - System Programming,Klara Nahrstedt13Single Processor Scheduling AlgorithmsBatch systems–First Come First Serve (FCFS)–Short Job FirstInteractive Systems–Round Robin–Priority Scheduling–Multi Queue & Multi-level Feedback–Shortest process time–Guaranteed Scheduling–Lottery Scheduling–Fair Sharing Scheduling01/14/19 CS 241 - System Programming,Klara Nahrstedt14First Come First Serve (FCFS)(Batch Scheduling Policy)Process that requests the CPU FIRST is allocated the CPU FIRST. Also called FIFONon-preemptiveUsed in Batch Systems Real life analogy: Fast food restaurantImplementation: FIFO queues– A new process enters the tail of the queue–The schedule selects from the head of the queue. Performance Metric: Average Waiting Time. Given Parameters: –Burst Time (in ms), Arrival Time and Order01/14/19 CS 241 - System Programming,Klara Nahrstedt15FCFS ExampleProcess Duration Order Arrival TimeP1 24 1 0P2 3 2 0P3 4 3 0The final schedule:0P1 (24)24 27P2 (3) P3 (4)P1 waiting time: 0P2 waiting time: 24P3 waiting time: 27The average waiting time: (0+24+27)/3 = 1701/14/19 CS 241 - System Programming,Klara Nahrstedt16Problems with FCFSNon-preemptiveNot optimal AWTCannot utilize resources in parallel:–Assume 1 process CPU bounded and many I/O bounded processes –result: Convoy effect, low CPU and I/O Device utilization –Why?01/14/19 CS 241 - System Programming,Klara Nahrstedt17FCFS PerformanceWhat is the impact of convey effect?a) Slows down CPU bound processes?b) Slows down I/O bound processes?c) Low CPU utilization? d) Low I/O device utilization?e) All of the above?01/14/19 CS 241 - System Programming,Klara Nahrstedt18Convoy EffectsConsider n-1 jobs in system that are I/O bound and 1 job that is CPU bound. I/O bound jobs pass quickly through the ready queue and suspend themselves waiting for I/O. CPU bound job arrives at head of queue and


View Full Document

U of I CS 241 - Lecture 11

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 Lecture 11
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 Lecture 11 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 Lecture 11 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?