Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

scheduling algorithm

247 views

Published on

detail description of priority and round robin scheduling.

Published in: Education
  • Be the first to comment

scheduling algorithm

  1. 1. CPU SCHEDULING By- Nitish Kumar Sandhawar Roll-52 Id- 17049 Subject-Operating System PRIORITY AND ROUND ROBIN
  2. 2. CPU SHEDULING – CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold (in waiting state) due to due to unavailability of any resources like I/O etc,
  3. 3. CPU SCHEDULING CRITERIA Throughput- Keep the CPU as busy as possible (from 0% to 100%). CPU utilization-No. of processes that complete their execution per time unit. Turn AroundTime-Amount of time to execute a particular process. Response time-Amount of time it takes from when a request was submitted until the first response is produced. Waiting time-Amount of time a process has been waiting in the ready queue.
  4. 4. Different Types of Scheduling Algorithm There are two types of scheduling algorithm :- 1.Preemptive a) Preempted SJF (In some Cases)-also called pre-emptive SJF b) Preempted Priority (In some Cases)-also called pre-emptive Priority c) Round Robin d) Multilevel Queue Scheduling e) Multilevel Feedback Queue – 1.Non-Preemptive a) First Come First Serve b) Non-Preempted SJF
  5. 5. PRIORITY  The Priority scheduling algorithm is a general case of the SJF algorithm. It is a non-Preemptive, pre-emptive algorithm and one of the most common scheduling algorithms in batch systems.  Each process is assigned a priority. Process with highest priority is to be executed first and so on. Process with same priority are executed on FCFS basis.  In Priority algorithm priority (p) is the inverse of the given priority value. The larger the numeric value of priority, the lower the priority, and vice versa.  Priority can be decided based on memory requirements, time
  6. 6. Wait time of each process is as follows − Average Wait Time: (9+5+12+0) / 4 = 6.5 Proce ss Wait Time : Service Time - Arrival Time P0 9 - 0 = 9 P1 6 - 1 = 5 P2 14 - 2 = 12 P3 0 - 0 = 0
  7. 7. – Advantage-  Simplicity  Reasonable support for priority  Suitable for applications with varying and resource requirement. – Disadvantage-  Indefinite blocking or starvation.  A priority scheduling can leave some priority waiting processes indefinitely CPU.
  8. 8. ROUND ROBIN  Round Robin is the preemptive process scheduling algorithm.  Each process is provided a fix time to execute, it is called a quantum.  Once a process is executed for a given time period, it is preempted and other process executes for a given time period.  Context switching is used to save states of preempted processes.  The Round Robin scheduling is especially
  9. 9. Wait time of each process is as follows – Proc ess Wait Time : Service Time - Arrival Time P0 (0 - 0) + (12 - 3) = 9 P1 (3 - 1) = 2 P2 (6 - 2) + (14 - 9) + (20 - 17) = P3 (9 - 3) + (17 - 12) = 11 Average Wait Time: (9+2+12+11) / 4 = 8.5
  10. 10. Advantage- • There is fairness since every process gets equal CPU. • The newly created process is added to end of ready queue. • A round-robin scheduler generally employs time- sharing, giving each job a time slot or quantum. Disadvantage- • Very important jobs wait in line. • Largest job take enough time for completion. • Setting the quantum too short causes too many context switches and lower the CPU efficiency. • Setting the quantum too long may cause poor response
  11. 11. THANK YOU FOR YOUR PATIENCE

×