SJF Algo - Non Pre-emptive
Understand - 2 STEP
[ STEP -1 ] First ge yava process du arrival time 0 ide adannu gantt chart ge bariteve
[ STEP -2 ] Next yava process (example p1 ,p2 ,p3) du burst time smallest ide adannu navu select madteve.
That selected process CPU ge run madlike assign madteve that means we will write it in gantt chart.
Suppose 2 process same burst time idre First come First Serve Scheduling use agtade - this is not needed for our act.
That's it Maybe ๐ซก
This is the problem for act -
Read question if you want or else don't bother about it.
Process Id | Arrival time | Burst time |
P1 | 3 | 1 |
P2 | 1 | 4 |
P3 | 4 | 2 |
P4 | 0 | 6 |
P5 | 2 | 3 |
[ STEP -1 ] P4 du arrival time 0 so add it to gantt chart ( 0 to p4 burst time) = 6
[ STEP -2 ]
P1 arrival time is smallest so we add it to gantt chart ( 6 + p1 burst time ) = 7
P3 arrival time is smallest so we add it to gantt chart ( 7 + p3 burst time ) = 9
P5 arrival time is smallest so we add it to gantt chart ( 9 + p5 burst time ) = 12
P2 arrival time is smallest so we add it to gantt chart ( 12 + p2 burst time ) = 16
Check This -Gantt Chart
DONE FOR THE ACT !
Turn Around time = Exit time โ Arrival time
Waiting time = Turn Around time โ Burst time
Process Exit time Turn Around time Waiting time
P1 7 7 โ 3 = 4 4 โ 1 = 3
P2 16 16 โ 1 = 15 15 โ 4 = 11
P3 9 9 โ 4 = 5 5 โ 2 = 3
P4 6 6 โ 0 = 6 6 โ 6 = 0
P5 12 12 โ 2 = 10 10 โ 3 = 7
Subscribe to my newsletter
Read articles from Swasthik K directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by