DOC PREVIEW
U of I CS 241 - Lecture notes

This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 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 17 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 17 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 17 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 17 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 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

SchedulingContent of This LectureReview: State Process ModelOS Representation of Process via Process Control Block (PCB)Process SchedulingContext SwitchWhen to schedule?Queuing Diagram for ProcessesPreemptive vs. Non-preemptive schedulingScheduling ObjectivesPerformance CriteriaProcess ProfilesSimple Processor Scheduling AlgorithmsFirst Come First Serve (FCFS)FCFS ExampleProblems with FCFSSummaryCopyright ©: Nahrstedt, Angrave, Abdelzaher 1SchedulingCopyright ©: Nahrstedt, Angrave, Abdelzaher2Content of This LectureWhy CPU scheduling?Basic scheduling algorithmsFIFO (FCFS)Shortest job firstRound RobinPriority SchedulingGoals:Understand how your program is executed on the machine together with other programsCopyright ©: Nahrstedt, Angrave, Abdelzaher3Review: State Process ModelCopyright ©: Nahrstedt, Angrave, Abdelzaher4OS Representation of Process via Process Control Block (PCB)Copyright ©: Nahrstedt, Angrave, Abdelzaher5Process SchedulingDeciding which process/thread should occupy the resource (CPU, disk, etc)CPUProcess 1Process 2 Process 3I want to playWhose turn is it?Copyright ©: Nahrstedt, Angrave, Abdelzaher6Context Switch Switch CPU from one process to anotherPerformed by scheduler It includes: save PCB state of the old process; load PCB state of the new process;Flush memory cache;Change memory mapping (TLB);Context switch is expensive (1-1000 microseconds)No useful work is done (pure overhead)Can become a bottleneckNeed hardware supportCopyright ©: Nahrstedt, Angrave, Abdelzaher7When to schedule?A new process startsThe running process exitsThe running process is blocked I/O interrupt (some processes will be ready)Clock interrupt (every 10 milliseconds)Copyright ©: Nahrstedt, Angrave, Abdelzaher8Queuing Diagram for ProcessesReady QueueReady QueueI/O request inI/O request inDevice QueueDevice QueueTime SliceTime SliceExpiredExpiredFork a ChildFork a ChildWait for an Wait for an InterruptInterruptInterrupt Interrupt OccursOccursCreate Create Child Child CPUCPUI/OI/OUpdateUpdateAccountingAccountingCreate JobCreate JobCopyright ©: Nahrstedt, Angrave, Abdelzaher9Preemptive vs. Non-preemptive schedulingNon-preemptive scheduling:The running process keeps the CPU until it voluntarily gives up the CPU process exitsswitches to blocked state1 and 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 Blocked143Copyright ©: Nahrstedt, Angrave, Abdelzaher10Scheduling ObjectivesFairness (equitable shares of CPU)Priority (most important first)Efficiency (make best use of equipment)Encouraging good behavior (can’t take advantage of the system)Support for heavy loads (degrade gracefully)Adapting to different environments (interactive, real-time, multi-media)Copyright ©: Nahrstedt, Angrave, Abdelzaher11Performance 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 Proportionality: meet users' expectation Meeting Deadlines: avoid losing dataCopyright ©: Nahrstedt, Angrave, Abdelzaher12Process 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 timeCopyright ©: Nahrstedt, Angrave, Abdelzaher13Simple Processor Scheduling AlgorithmsBatch systemsFirst Come First Serve (FCFS)Shortest Job FirstInteractive SystemsRound RobinPriority Scheduling…Copyright ©: Nahrstedt, Angrave, Abdelzaher14First Come First Serve (FCFS)Process that requests the CPU FIRST is allocated the CPU FIRST. Also called FIFOPreemptive or Non-preemptive?Used in Batch Systems ImplementationFIFO queuesA new process enters the tail of the queueThe schedule selects from the head of the queue.Copyright ©: Nahrstedt, Angrave, Abdelzaher15FCFS 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 = 17What if P1 arrives at time 2Copyright ©: Nahrstedt, Angrave, Abdelzaher16Problems 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?Copyright ©: Nahrstedt, Angrave, Abdelzaher17Summary Why Scheduling?Scheduling objectivesScheduling AlgorithmsFCFS


View Full Document

U of I CS 241 - Lecture notes

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 notes
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 notes 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 notes 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?