1 / 23

Uniprocessor Scheduling

Uniprocessor Scheduling. Chapter 9 (Continued). Acknowledgment. Several (most?) transparencies are from the slide set prepared by Patricia Roy, and available on the Stallings OS site (many transparencies have been modified, and some added, to suit my plans).

ula
Download Presentation

Uniprocessor Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Uniprocessor Scheduling Chapter 9 (Continued)

  2. Acknowledgment • Several (most?) transparencies are from the slide set prepared by Patricia Roy, and available on the Stallings OS site (many transparencies have been modified, and some added, to suit my plans)

  3. Decision Mode • Nonpreemptive • Once a process is in the running state, it will continue until it terminates or blocks itself for I/O • 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

  4. Process Scheduling Example

  5. 5 0 10 15 20 FCFS Assuming processes do not perform any I/O • Each process joins the Ready queue • When the current process ceases to execute, the oldest process in the Ready queue is selected 1 2 3 4 5

  6. First-Come-First-Served(FCFS) • If processes do not perform I/O, a short process may have to wait a very long time before it can execute • If processes perform I/O, and both I/O-bound and CPU-bounds processes exist, FCFS policy favors CPU-bound processes. **** Someone explain this!!!

  7. 5 0 10 15 20 Round-Robin • Uses preemption based on a clock • Again, someone explain this!!! 1 2 3 4 5

  8. 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 process is selected • Known as time slicing

  9. 5 0 10 15 20 1 2 3 4 5 Shortest Process Next • Nonpreemptive policy • Process with shortest expected processing time is selected next • Short process jumps ahead of longer processes

  10. Shortest Process Next • Predictability of longer processes is reduced • If estimated time for process not correct, the operating system may abort it • Possibility of starvation for longer processes • Very difficult to use in practice! • Q: Does it offer better throughput than, say, FCFS or round-robin?

  11. 5 0 10 15 20 1 2 3 4 5 Shortest Remaining Time • Preemptive version of shortest process next policy • Must estimate processing time correctly

  12. 5 0 10 15 20 Highest Response Ratio Next (HRRN) • Choose next process with the highest ratio 1 2 3 4 5 time spent waiting + expected service time expected service time

  13. 5 0 10 15 20 1 2 3 4 5 Feedback • Penalize processes that use too much CPU time by reducing priority of a process every time it gets preempted • High priority given when it finishes I/O

  14. Fair-Share Scheduling • User’s 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 in an application • A `fair share’ for an application (or group of processes) is a specified fraction of CPU time

  15. Fair-share scheduling • Specify fair shares for different applications/groups of processes • Try to provide the fair share to each group • Accumulate the CPU time used -- individually by each process -- by groups of processes and adjust process priorities accordingly

  16. Fair-share scheduling • CPU(i) = CPU(i-1)/2 -- for a process • GCPU(i) = GCPU(i-1)/2 – for a group • P(i) = Base + CPU(i-1)/2 + GCPU(i-1)/(4 x W) where `w’ is the fair share of the group of processes

  17. UNIX Scheduling • Multilevel feedback using round robin within each of the priority queues • Priorities are recomputed once per second • A large numerical value of priority indicates low effective priority

  18. UNIX Scheduling Compute P(i) every second as follows: CPU(i) = CPU(i-1)/2 • P(i) = Base + CPU(i-1)/2 + nice • *** Change CPU(i-1) to CPU(i) ***??!! • Base priority divides all processes into fixed bands of priority levels • Adjustment factor used to keep process in its assigned band

  19. Priority Bands • Base priorities are defined to provide decreasing order of priority to • Swapper • Block I/O device control • File manipulation • Character I/O device control • User processes

  20. Unix scheduling • How is this scheduling different from round robin scheduling with time slicing?

More Related