© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling assumptions.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Metrics zHow do we evaluate a scheduling policy: yAbility to satisfy all deadlines. yCPU utilization---percentage of time devoted to useful work. yScheduling overhead---time required to make scheduling decision.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Rate monotonic scheduling zRMS (Liu and Layland): widely-used, analyzable scheduling policy. zAnalysis is known as Rate Monotonic Analysis (RMA).
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMA model zAll process run on single CPU. zZero context switch time. zNo data dependencies between processes. zProcess execution time is constant. zDeadline is at end of period. zHighest-priority ready process runs.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Process parameters T i is computation time of process i; i is period of process i. period i Pi computation time T i
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Rate-monotonic analysis zResponse time: time required to finish process. zCritical instant: scheduling state that gives worst response time. zCritical instant occurs when all higher- priority processes are ready to execute.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Critical instant P4 P3 P2 P1 critical instant P1 P2 P3 interfering processes
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMS priorities zOptimal (fixed) priority assignment: yshortest-period process gets highest priority; ypriority inversely proportional to period; ybreak ties arbitrarily. zNo fixed-priority scheme does better.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMS example time 0510 P2 period P1 period P1 P2 P1
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMS CPU utilization zUtilization for n processes is i T i / i zAs number of tasks approaches infinity, maximum utilization approaches 69%.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMS CPU utilization, cont’d. zRMS cannot use 100% of CPU, even with zero context switch overhead. zMust keep idle cycles available to handle worst-case scenario. zHowever, RMS guarantees all processes will always meet their deadlines.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. RMS implementation zEfficient implementation: yscan processes; ychoose highest-priority active process.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Earliest-deadline-first scheduling zEDF: dynamic priority scheduling scheme. zProcess closest to its deadline has highest priority. zRequires recalculating processes at every timer interrupt.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. EDF analysis zEDF can use 100% of CPU. zBut EDF may fail to miss a deadline.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. EDF implementation zOn each timer interrupt: ycompute time to deadline; ychoose process closest to deadline. zGenerally considered too expensive to use in practice.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Fixing scheduling problems zWhat if your set of processes is unschedulable? yChange deadlines in requirements. yReduce execution times of processes. yGet a faster CPU.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Priority inversion zPriority inversion: low-priority process keeps high-priority process from running. zImproper use of system resources can cause scheduling problems: yLow-priority process grabs I/O device. yHigh-priority device needs I/O device, but can’t get it until low-priority process is done. zCan cause deadlock.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Solving priority inversion zGive priorities to system resources. zHave process inherit the priority of a resource that it requests. yLow-priority process inherits priority of device if higher.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Data dependencies zData dependencies allow us to improve utilization. yRestrict combination of processes that can run simultaneously. zP1 and P2 can’t run simultaneously. P1 P2
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Context-switching time zNon-zero context switch time can push limits of a tight schedule. zHard to calculate effects---depends on order of context switches. In practice, OS context switch overhead is small (hundreds of clock cycles) relative to many common task periods (ms – s).