Professional Documents
Culture Documents
3 Cpu Scheduling SJF RSJF
3 Cpu Scheduling SJF RSJF
3 Cpu Scheduling SJF RSJF
Akhtar Husain
Associate Professor in Department of CSIT,
Faculty of Engineering and Technology,
MJP Rohilkhand University, Bareilly, U.P., India.
Mobile : 9457381048, 9319760019
Email: akhtarhusain@mjpru.ac.in
Shortest Job First-SJF Scheduling
• preemptive SJF will stop currently executing process and starts the
execution of newly entered process. Its also called Shortest
Remaining Time First (SRTF).
0 2 5 10 15 20
P1 3 0 5 5 2
P2 5 0 10 10 5
P3 2 0 2 2 0
P4 5 0 15 15 10
P5 5 0 20 20 15
Gantt Chart
P1 P3 P2 P4 P5
0 3 5 10 15 20
P1 3 0 3 3 0
P2 5 1 10 9 4
P3 2 3 5 2 0
P4 5 9 15 6 1
P5 5 12 20 8 3
Case 3 for preemptive Scheduling : When all the processes enter into
the ready queue at times i.e. at 0 ms, 1 ms, 3 ms, 9 ms and 12 ms
respectively.
Gantt Chart
P1 P2 P1 P3 P1 P4 P5
0 1 2 3 5 8 9 14 19
P1 5 0 8 8 3
P2 1 1 2 1 0
P3 2 3 5 2 0
P4 5 9 14 5 0
P5 5 12 19 7 2