SJF Algo - Non Pre-emptive

Swasthik KSwasthik K
2 min read

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.
Consider the set of 5 processes whose arrival time and burst time are given below - If the CPU scheduling policy is SJF non-preemptive, calculate the average waiting time and average turn around time.
Process IdArrival timeBurst time
P131
P214
P342
P406
P523
  • [ 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
0
Subscribe to my newsletter

Read articles from Swasthik K directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Swasthik K
Swasthik K