Scheduling Algorithems First Come First Serve Scheduling Shortest Job First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling

Download Scheduling Algorithems First Come First Serve Scheduling Shortest Job First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling

Post on 29-Mar-2015




0 download

Embed Size (px)


<ul><li>Slide 1</li></ul> <p>Scheduling Algorithems First Come First Serve Scheduling Shortest Job First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling Multilevel Feedback-Queue Scheduling Slide 2 Round-Robin Scheduling The Round-Robin is designed especially for time sharing systems. It is similar FCFS but add preemption concept A small unit of time, called time quantum, is defined Slide 3 Round-Robin Scheduling Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. Slide 4 Round-Robin Scheduling Slide 5 If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Slide 6 Round-Robin Scheduling Performance q large =&gt; FIFO q small =&gt; q must be large with respect to context switch, otherwise overhead is too high Typically, higher average turnaround than SJF, but better response Slide 7 Round-Robin Scheduling Slide 8 Multilevel Queue Ready queue is partitioned into separate queues: foreground (interactive) background (batch) Each queue has its own scheduling algorithm foreground RR background FCFS Slide 9 Multilevel Queue example Foreground P1 53 (RR interval:20) P2 17 P3 42 Background P4 30 (FCFS) P5 20 Slide 10 Multilevel Queue Scheduling must be done between the queues Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. Time slice each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR Slide 11 Multilevel Queue Slide 12 Multilevel Feedback Queue Three queues: Q0 RR with time quantum 8 milliseconds Q1 RR time quantum 16 milliseconds Q2 FCFS Scheduling A new job enters queue Q0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q1. At Q1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q2. Slide 13 Multilevel Feedback Queue Slide 14 P1 40 P2 35 P3 15 Slide 15 5.4 Multiple-Processor Scheduling We concentrate on systems in which the processors are identical (homogeneous) Asymmetric multiprocessing (by one master) is simple because only one processor access the system data structures. Symmetric multiprocessing, each processor is self-scheduling. Each processor may have their own ready queue. Slide 16 Load balancing On symmetric multiprocessing systems, it is important to keep the workload balanced among all processors to fully utilized the benefits of having more than one CPU There are two general approached to load balancing: Push Migration and Pull Migration Slide 17 Symmetric Multithreading An alternative strategy for symmetric multithreading is to provide multiple logical processors (rather than physical) Its called hyperthreading technology on Intel processors Slide 18 Symmetric Multithreading The idea behind it is to create multiple logical processors on the same physical processor (sounds like two threads) But it is not software provide the feature, but hardware Each logical processor has its own architecture state, each logical processor is responsible for its own interrupt handling. Slide 19 Symmetric Multithreading Slide 20 Operating System Examples Operating Solaris scheduling Windows XP scheduling Linux scheduling Slide 21 Solaris Scheduling Slide 22 Solaries uses priority-based scheduling The default scheduling class for a process is time sharing The higher the priority, the smaller the time slice The scheduling policy gives good response time for interactive process and good throughput for CPU-bound process It includes 60 priority levels Slide 23 Solaris Dispatch Table Priority: a higher number indicates a higher priority Time Quantum: the time quantum for the associated priority Time Quantum expired: the priority of a thread that has used its entire time quantum without blocking Return from sleep: the priority of a thread that is returning from sleeping (such as waiting for I/O) Slide 24 Solaris Dispatch Table Slide 25 Windows XP Windows XP schedules threads using a priority-based, preemptive scheduling algorithm The values of the priority classes appears in the top row The left columns contains the values for the relative priorities. The base priority is the value of the normal relative priority for the specific class Slide 26 Windows XP Slide 27 Linux Scheduling The Linux scheduling use a preemptive, priority based algorithm with two separate priority ranges: a real-time range from 0 to 99 and a nice value ranging from 100 to 140 Lower values indicates higher priority Unlike Solaries and XP, Linux assigns higher-priority tasks longer time quanta Slide 28 Linux Scheduling Slide 29 Algorithm Evaluation Deterministic Modeling Simulations Implementation Slide 30 Deterministic Modeling Deterministic Modeling: Process Burst Time P1 10 P2 29 P3 3 P4 7 P5 12 Slide 31 Deterministic Modeling Deterministic model is simple and fast. It gives the exact numbers, allowing us to compare the algorithms. However, it requires exact numbers for input, and its answers apply only to these cases. Slide 32 Simulation Slide 33 Implementation Even a simulation is of limited accuracy. The only completely accurate way to evaluate a scheduling algorithm is to code it up, put it in the operating system and see how it works. </p>


View more >