Click to edit Master title style 1 CPU Scheduling Algorithm (SJF, Round-Robin, Priority) - Non Preemptive P r e s e n t e d B y M e h e n a z T a h e r i n S o l a i m a n H r i d o y M d . E h s a n u l I s l a m K h a n S a m i a A k t e r P u s h p i t a D u t t a I D : 1 7 0 1 0 1 1 4 I D : 1 7 0 1 0 1 1 5 I D : 1 7 0 1 0 1 1 6 I D : 1 7 0 1 0 1 1 7 I D : 1 7 0 1 0 1 1 8
Click to edit Master title style 2 Table of Contents • Definitions …………………………………………………………………………….. 01 • Shortest Job First (SJF) – without arrival time …………………………..02 • Shortest Job First (SJF) – with arrival time ……………………………….03 • Priority – without arrival time …………………………………………………. 04 • Priority – with arrival time …………………………..…………………………..05 • Round-Robin – without arrival time …………….……………………………06
Click to edit Master title style 3 Definitions • SJF : Shortest Job First scheduling works on the process with the shortest burst time or duration first. • Priority: In this scheduling, processes are scheduled according to their priorities, i.e., highest priority process is scheduled first. If priorities of two processes match, then schedule according to arrival time. • Round –Robin: A fixed time is allotted to each process, called quantum, for execution. Once a process is executed for given time period that process is preempted and other process executes for given time period. 01
Click to edit Master title style 4 Shortest Job First(SJF) without arrival time – Non Preemptive Process Burst Time P1 21 P2 3 P3 6 P4 2 P4 P2 P3 P1 TABLE Gantt Chart 0 2 5 11 32 Waiting Time, P1 = 11, P2 = 2, P3 = 5, P4 = 0 Average Waiting Time = (11+2+5+0) / 4 = 4.5 ms 02
Click to edit Master title style 5 Shortest Job First(SJF) with arrival time – Non Preemptive Process AT BT CT TAT WT P1 1 21 22 21 0 P2 3 3 27 24 21 P3 6 6 33 27 21 P4 7 2 24 17 15 P1 P4 P2 p3 TABLE Gantt Chart 22 TAT = CT – AT WT = TAT - BT Average Waiting Time = (0+21+21+15) / 4 = 14.25 ms 0 1 24 27 33 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Turn Around Time = (21+24+27+17) / 4 = 22.25 ms 03
Click to edit Master title style 6 Priority Scheduling without arrival time – Non Preemptive Process Burst Time Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 p5 5 2 P2 P5 P1 P3 p4 TABLE Gantt Chart Waiting Time, P1 = 6, P2 = 0, P3 = 16 , P4 = 18, P5 = 1 Average Waiting Time = (6+0+16+18+1) / 5 = 8.2 ms 0 1 6 16 1918 Process Burst Time Priority P2 1 1 P5 5 2 P1 10 3 P3 2 4 P4 1 5 Sorted Table 04
Click to edit Master title style 7 Priority Scheduling with arrival time – Non Preemptive Proces s AT BT Prio rity CT TAT WT P1 0 6 2 6 6 0 P2 2 1 4 14 12 11 P3 4 4 1 10 6 2 P4 5 3 3 13 8 5 P1 P3 P4 P2 TABLE Gantt Chart TAT = CT – AT WT = TAT - BT Average Waiting Time = (0+11+2+5) / 4 = 4.5 ms 60 10 13 14 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Turn Around Time = (6+12+6+8) / 4 = 8 ms 05
Click to edit Master title style 8 Round-Robin Scheduling without arrival time – Non Preemptive P1 P2 P3 P4 P5 P1 P2 P4 p5 P1 P2 P5 TABLE Gantt Chart Average TAT= (19+20+6+15+23) / 5 = 16.6 ms 0 2 17 19 23201264 Time Quantum = 2 ms Arrival Time = 0 06 Process BT RT WT CT TAT P1 6 4, 2, 0 13 19 19 P2 5 3,1,0 15 20 20 P3 2 0 4 6 6 P4 3 1,0 12 15 15 p5 7 5,3,0 16 23 23 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Waiting Time = (13+15+4+12+16) / 5 = 12 ms TAT = CT – AT WT = TAT – BT Ready Queue: P1, P2, P3, P4, P5, P1, P2, P4, P5, P1,P2, P5 8 10 14 15
Click to edit Master title style 9 Thank You

CPU Scheduling Algorithm (SJF, Round-Robin, Priority)

  • 1.
    Click to editMaster title style 1 CPU Scheduling Algorithm (SJF, Round-Robin, Priority) - Non Preemptive P r e s e n t e d B y M e h e n a z T a h e r i n S o l a i m a n H r i d o y M d . E h s a n u l I s l a m K h a n S a m i a A k t e r P u s h p i t a D u t t a I D : 1 7 0 1 0 1 1 4 I D : 1 7 0 1 0 1 1 5 I D : 1 7 0 1 0 1 1 6 I D : 1 7 0 1 0 1 1 7 I D : 1 7 0 1 0 1 1 8
  • 2.
    Click to editMaster title style 2 Table of Contents • Definitions …………………………………………………………………………….. 01 • Shortest Job First (SJF) – without arrival time …………………………..02 • Shortest Job First (SJF) – with arrival time ……………………………….03 • Priority – without arrival time …………………………………………………. 04 • Priority – with arrival time …………………………..…………………………..05 • Round-Robin – without arrival time …………….……………………………06
  • 3.
    Click to editMaster title style 3 Definitions • SJF : Shortest Job First scheduling works on the process with the shortest burst time or duration first. • Priority: In this scheduling, processes are scheduled according to their priorities, i.e., highest priority process is scheduled first. If priorities of two processes match, then schedule according to arrival time. • Round –Robin: A fixed time is allotted to each process, called quantum, for execution. Once a process is executed for given time period that process is preempted and other process executes for given time period. 01
  • 4.
    Click to editMaster title style 4 Shortest Job First(SJF) without arrival time – Non Preemptive Process Burst Time P1 21 P2 3 P3 6 P4 2 P4 P2 P3 P1 TABLE Gantt Chart 0 2 5 11 32 Waiting Time, P1 = 11, P2 = 2, P3 = 5, P4 = 0 Average Waiting Time = (11+2+5+0) / 4 = 4.5 ms 02
  • 5.
    Click to editMaster title style 5 Shortest Job First(SJF) with arrival time – Non Preemptive Process AT BT CT TAT WT P1 1 21 22 21 0 P2 3 3 27 24 21 P3 6 6 33 27 21 P4 7 2 24 17 15 P1 P4 P2 p3 TABLE Gantt Chart 22 TAT = CT – AT WT = TAT - BT Average Waiting Time = (0+21+21+15) / 4 = 14.25 ms 0 1 24 27 33 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Turn Around Time = (21+24+27+17) / 4 = 22.25 ms 03
  • 6.
    Click to editMaster title style 6 Priority Scheduling without arrival time – Non Preemptive Process Burst Time Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 p5 5 2 P2 P5 P1 P3 p4 TABLE Gantt Chart Waiting Time, P1 = 6, P2 = 0, P3 = 16 , P4 = 18, P5 = 1 Average Waiting Time = (6+0+16+18+1) / 5 = 8.2 ms 0 1 6 16 1918 Process Burst Time Priority P2 1 1 P5 5 2 P1 10 3 P3 2 4 P4 1 5 Sorted Table 04
  • 7.
    Click to editMaster title style 7 Priority Scheduling with arrival time – Non Preemptive Proces s AT BT Prio rity CT TAT WT P1 0 6 2 6 6 0 P2 2 1 4 14 12 11 P3 4 4 1 10 6 2 P4 5 3 3 13 8 5 P1 P3 P4 P2 TABLE Gantt Chart TAT = CT – AT WT = TAT - BT Average Waiting Time = (0+11+2+5) / 4 = 4.5 ms 60 10 13 14 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Turn Around Time = (6+12+6+8) / 4 = 8 ms 05
  • 8.
    Click to editMaster title style 8 Round-Robin Scheduling without arrival time – Non Preemptive P1 P2 P3 P4 P5 P1 P2 P4 p5 P1 P2 P5 TABLE Gantt Chart Average TAT= (19+20+6+15+23) / 5 = 16.6 ms 0 2 17 19 23201264 Time Quantum = 2 ms Arrival Time = 0 06 Process BT RT WT CT TAT P1 6 4, 2, 0 13 19 19 P2 5 3,1,0 15 20 20 P3 2 0 4 6 6 P4 3 1,0 12 15 15 p5 7 5,3,0 16 23 23 AT = Arrival Time BT = Burst Time CT = Completion Time TAT = Turn Around Time WT = Waiting Time Average Waiting Time = (13+15+4+12+16) / 5 = 12 ms TAT = CT – AT WT = TAT – BT Ready Queue: P1, P2, P3, P4, P5, P1, P2, P4, P5, P1,P2, P5 8 10 14 15
  • 9.
    Click to editMaster title style 9 Thank You