Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scheduling Algorithems

Similar presentations

Presentation on theme: "Scheduling Algorithems"— Presentation transcript:

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

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

3 Round-Robin Scheduling
Each process gets a small unit of CPU time (time quantum), usually milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue.

4 Round-Robin Scheduling

5 Round-Robin Scheduling
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.

6 Round-Robin Scheduling
Performance q large => FIFO q small => q must be large with respect to context switch, otherwise overhead is too high Typically, higher average turnaround than SJF, but better response

7 Round-Robin Scheduling

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

9 Multilevel Queue example
Foreground P (RR interval:20) P P Background P (FCFS) P

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

11 Multilevel Queue

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.

13 Multilevel Feedback Queue

14 Multilevel Feedback Queue
P1 40 P2 35 P3 15

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.

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

17 Symmetric Multithreading
An alternative strategy for symmetric multithreading is to provide multiple logical processors (rather than physical) It’s called hyperthreading technology on Intel processors

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.

19 Symmetric Multithreading

20 Operating System Examples Operating
Solaris scheduling Windows XP scheduling Linux scheduling

21 Solaris Scheduling

22 Solaris Scheduling 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

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)

24 Solaris Dispatch Table

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

26 Windows XP

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

28 Linux Scheduling

29 Algorithm Evaluation Deterministic Modeling Simulations Implementation

30 Deterministic Modeling
Process Burst Time P P P P P

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.

32 Simulation

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.

Download ppt "Scheduling Algorithems"

Similar presentations

Ads by Google