Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,

Similar presentations


Presentation on theme: "Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,"— Presentation transcript:

1 Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall

2 Aim of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency

3 Processor Scheduling Known as the dispatcher Invoked when an event occurs –Clock interrupts –I/O interrupts –Operating system calls –Signals

4 Processor Scheduling Criteria User-oriented –Response Time Elapsed time between the submission of a request until there is an output –Turnaround Time The time between the submission and the completion of a process System-oriented –Effective and efficient utilization of the processor

5 Decision Mode Nonpreemptive –Once a process is in the running state, it will continue until it terminates or blocks itself for I/O

6 Decision Mode Preemptive –Currently running process may be interrupted and moved to the Ready state by the operating system –Allows for better service since any one process cannot monopolize the processor for very long

7 Priorities Scheduler will always choose a process of higher priority over one of lower priority Have multiple ready queues to represent each level of priority

8 Priority Queuing

9 Priorities Lower-priority may suffer starvation –Allow a process to change its priority based on its age or execution history

10 First-Come-First-Served Each process joins the Ready queue When the current process ceases to execute, the process that waits the longest in the Ready queue is selected

11 Process Scheduling Example

12 First-Come-First-Served A short process may have to wait a very long time before it can execute Favors CPU-bound processes –I/O processes have to wait until CPU-bound process completes –Low utilization for I/O devices –Possibly low utilization for processor

13 Round Robin Clock interrupt is generated at periodic intervals When an interrupt occurs, the currently running process is placed in the ready queue –Next ready job is selected Known as time slicing

14 Round Robin Uses preemption based on a clock

15 Round Robin Time quantum is –The time interval between two clock interrupts –The maximum time allocated to a processs execution in each turn

16 Round Robin Which type of processes are favored by round robin scheduling? –CPU or I/O bound processes?

17 Round Robin Example: A, C, D, E: CPU bound processes; B: I/O bound process. What should we do to treat them fairly in terms of CPU allocation? A B C D E

18 Round Robin Which type of processes are favored by round robin scheduling? –CPU or I/O bound processes? Favors CPU-bound processes –CPU-bound process gets more CPU time –I/O process has to wait for CPU-bound processes to consume their quanta before its turn of executing on the CPU

19 Queuing Diagram Virtual round robin Use an auxiliary queue to hold processes that have I/O requests serviced Process in auxiliary queue gets preference over those in the main ready queue Process from the auxiliary queue runs for remaining time from last time-slice

20 Shortest Process Next Process with shortest expected processing time is selected next Short process jumps ahead of longer processes Nonpreemptive policy

21 Shortest Process Next

22 Possibility of starvation for longer processes If estimated time for process not correct, the operating system may abort it How to estimate a process execution time? Average of history? Simple average: S n+1 = 1/n T i Exponential average: S n+1 = T n + (1- )S n –Greater weights to more recent instances

23 Shortest Remaining Time Preemptive version of shortest process next policy

24 Highest Response Ratio Next Choose next process with the greatest ratio –shorter processes are favored –aging without service increases the ratio so that a longer process will eventually be served

25 Highest Response Ratio Next Choose next process with the greatest ratio

26 Feedback Scheduling Dont know remaining time process needs to execute Penalize jobs that have been running longer: putting them into lower priority ready queues

27 Feedback Scheduling

28

29 Fair-Share Scheduling Users application runs as a collection of processes (threads) User is concerned about the performance of the application Need to make scheduling decisions based on process sets

30 Fair-Share Scheduling CPU j (i) = CPU j (i-1)/2 GCPU k (i) = GCPU k (i-1)/2 P j (i) = Base j + CPU j (i)/2 + GCPU k (i)/(4W k )

31 Fair-Share Scheduler

32 In-Class Exercise Prob. 9.2 Consider the following set of processes: Perform FCFS, RR (q=4), SPN, SRT, HRRN, Feedback (q=2 i ) on them and get the Finish Time and Turnaround Time for each process. Process NameArrival TimeProcessing Time ABCDEABCDE 0 1 3 9 12 3525535255

33 Appendix

34 Exponential Smoothing Coefficients

35 Use Of Exponential Averaging

36

37 Effect of Size of Preemption Time Quantum

38


Download ppt "Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,"

Similar presentations


Ads by Google