## Friday, 9 March 2012

### Example of Preemptive SJF

Process  Arrival Time  Burst Time
P1                  0.0                  7
P2                   2.0                  4
P3                   4.0                   1
P4                   5.0                   4
• SJF (preemptive)

• Average waiting time = (9 + 1 + 0 +2)/4 - 3

1. p2 avg waiting time is wrong it should be

9+0+0+2/4

2. its correct...it is 9 + 1 + 0 + 2 / 4

3. Process | Arrival Time | Burst Time
-----------------------------------
P1 | 0.0 | 5
P2 | 3.0 | 5
P3 | 5.0 | 3
P4 | 7.0 | 2

Average Waiting Time and Gantt Chart using Shortest Job First (Preemptive)
Please Can you tell me how to solve this ?

4. I have doubt in above solution, that is p3 finished at 5, and arr time of p5 is 5.so shouldn't we start p5 even though it is not shortest but its arr time is 5 instead of starting p2.

5. same confusion here i think p2 should nt come after p3 p4 should cz its arrival time is 5 nd p3 completes ob 5

6. its completey wrong ...its sjf means short job should come first so according to that p3,p2,p4,p1 is d correct way

7. goodboy u are right

8. its correct, thats preemptive, so we have to check after each new job arrive what is the remaining time, and the one with the shortest remaining time gets the priority.

9. process name | Arrival time | burst time
A | 0 | 4
B | 2 | 7
C | 3 | 2
D | 3 | 2 plz any one tell the waiting time and turn arround time for each process

10. p1 = 0+ (11-2) =9
p2= 2+ (5-4)=3-2 =1
p3 = 4- 4 = 0
p4=7-5=2

9+1+0+2=12/4 = 3