DOC PREVIEW
CMU CS 15410 - Lecture

This preview shows page 1-2-14-15-29-30 out of 30 pages.

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

Unformatted text preview:

15-410, S’04- 1 -SchedulingMar. 15, 2004Dave EckhardtDave EckhardtBruce MaggsBruce MaggsL20a_Scheduling15-410“...Everything old is new again...”15-410, S’04- 2 -SynchronizationCheckpoint 2Checkpoint 2Monday, March 22Watch for detailsFinal Exam list postedFinal Exam list postedYou must notify us of conflicts in a timely fashionToday would be good15-410, S’04- 3 -OutlineChapter 6: SchedulingChapter 6: Scheduling15-410, S’04- 4 -CPU-I/O CycleProcessProcess view: 2 states view: 2 statesRunningWaiting for I/OLife CycleI/O (loading executable), CPU, I/O, CPU, .., CPU (exit())SystemSystem view viewRunning, WaitingRunnable – not enough processors for you right nowRunning Running ⇒⇒ waiting is mostly voluntary waiting is mostly voluntaryHow long do processes choose to run before waiting?15-410, S’04- 5 -CPU Burst LengthsOverallOverallExponential fall-off in CPU burst length0 5 10 15 20 25 30010203040506070809010015-410, S’04- 6 -CPU Burst Lengths“CPU-bound” program“CPU-bound” programBatch jobLong CPU bursts0 5 10 15 20 25 30010203040506070809010015-410, S’04- 7 -CPU Burst Lengths“ I/O-bound” program“ I/O-bound” programCopy, Data acquisition, ...Tiny CPU bursts between system calls0 5 10 15 20 25 30010203040506070809010015-410, S’04- 8 -Preemptive?Four opportunities to scheduleFour opportunities to scheduleA running process waits (I/O, child, ...)A running process exitsA waiting process becomes runnable (I/O done)Other interrupt (clock, page fault)Multitasking typesMultitasking typesFully Preemptive: All four cause scheduling“ Cooperative” : only first two15-410, S’04- 9 -Preemptive kernel?Preemptive multitaskingPreemptive multitaskingAll four cases cause context switchPreemptive Preemptive kernelkernelAll four cases cause context switch in kernel modeThis is a goal of Project 3System calls: interrupt disabling only when really necessaryClock interrupts should suspend system call execution15-410, S’04- 10 -CPU SchedulerInvoked when CPU becomes idleInvoked when CPU becomes idleCurrent task blocksClock interruptSelect next taskSelect next taskQuicklyPCB's in: FIFO, priority queue, tree, ...Switch (using “ dispatcher” )Switch (using “ dispatcher” )Your term may vary15-410, S’04- 11 -DispatcherSet down running taskSet down running taskSave register stateUpdate CPU usage informationStore PCB in “run queue”Pick up designated taskPick up designated taskActivate new task's memory Protection, mappingRestore register stateTransfer to user mode15-410, S’04- 12 -Scheduling CriteriaSystem administrator viewSystem administrator viewMaximize/trade off CPU utilization (“ busy-ness” ) Throughput (“ jobs per second” )Process viewProcess viewMinimize Turnaround time (everything) Waiting time (runnable but not running)User view (interactive processes)User view (interactive processes)Minimize response time (input/output latency)15-410, S’04- 13 -AlgorithmsDon't try these at homeDon't try these at homeFCFSSJFPriorityReasonableReasonableRound-RobinMulti-level (plus feedback)Multiprocessor, real-timeMultiprocessor, real-time15-410, S’04- 14 -FCFS- First Come, First ServedBasic ideaBasic ideaRun task until it relinquishes CPUWhen runnable, place at end of FIFO queueWaiting time Waiting time veryvery dependent on mix dependent on mix“ Convoy effect”“ Convoy effect”N tasks each make 1 I/O request, stall1 task executes very long CPU burstLather, rinse, repeatN “ I/O-bound tasks” can't keep I/O device busy!15-410, S’04- 15 -SJF- Shortest Job FirstBasic ideaBasic ideaChoose task with shortest next CPU burstWill give up CPU soonest, be “ nicest” to other tasksProvably “ optimal” Minimizes average waiting time across tasksPractically impossible (oh, well) Could predict next burst length...»Text presents exponential average»Does not present evaluation (Why not? Hmm...)15-410, S’04- 16 -PriorityBasic ideaBasic ideaChoose “most important” waiting task (Nomenclature: does “ high priority” mean p=0 or p=255?)Priority assignmentPriority assignmentStatic: fixed property (engineered?)Dynamic: function of task behaviorBig problem: Big problem: StarvationStarvation“ Most important” task gets to run often“ Least important “ task may never runPossible hack: priority “aging”15-410, S’04- 17 -Round-RobinBasic ideaBasic ideaRun each task for a fixed “ time quantum”When quantum expires, append to FIFO queue“ Fair”“ Fair”But not “provably optimal”Choosing quantum lengthChoosing quantum lengthInfinite (until process does I/O) = FCFSInfinitesimal (1 instruction) = “Processor sharing”Balance “fairness” vs. context-switch costs15-410, S’04- 18 -True “ Processor Sharing”CDC Peripheral ProcessorsCDC Peripheral ProcessorsMemory latencyMemory latencyLong, fixed constantEvery instructionSolution: round robinSolution: round robinQuantum = 1 instructionMemoryProcessor CoreRegister SetRegister SetRegister SetRegister SetRegister Set15-410, S’04- 19 -True “ Processor Sharing”CDC Peripheral ProcessorsCDC Peripheral ProcessorsMemory latencyMemory latencyLong, fixed constantEvery instructionSolution: round robinSolution: round robinQuantum = 1 instructionOne “ process” runningN-1 “ processes” waitingMemoryProcessor CoreRegister SetRegister SetRegister SetRegister SetRegister Set15-410, S’04- 20 -True “ Processor Sharing”Each instructionEach instruction“ Brief” computationOne load xor one storeSleeps process N cyclesSteady stateSteady stateRun when readyReady when it's your turnMemoryProcessor CoreRegister SetRegister SetRegister SetRegister SetRegister Set15-410, S’04- 21 -Everything Old Is New AgainIntel “ hyperthreading”Intel “ hyperthreading”N register setsM functional unitsSwitch on long-running operationsSharing less regularSharing illusion more lumpyGood for some application mixesMemoryProcessor CoreRegister SetRegister SetRegister SetRegister SetRegister Set15-410, S’04- 22 -Multi-level QueueN independent process queuesN independent process queuesOne per priorityAlgorithm per-queuePriority 0P1 P7Priority 1P2 P9 P3BatchP0 P4R. RobinR. RobinFCFS15-410, S’04- 23 -Multi-level


View Full Document

CMU CS 15410 - Lecture

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