Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Microcomputer Operating 1. Suppose there are 5 jobs in the ready queue. Processe

ID: 672632 • Letter: M

Question

Microcomputer Operating

1. Suppose there are 5 jobs in the ready queue. Processes’ arrival time and burst time are shown as below:

Process                    Arrival Time                        Burst Time

P1                                   0.0                                       11

P2                                   4.0                                        8

P3                                   5.0                                        5

P4                                   7.0                                        6

P5                                   9.0                                        1

All the processes are non-preemptive. Show your show solution in Gantt chart for SJF Scheduling and calculate the average waiting time.

2. Suppose there are 5 jobs in the ready queue. Processes’ arrival time and burst time are shown as below:

Process                    Arrival Time                        Burst Time

P1                                   0.0                                       11

P2                                   4.0                                        8

P3                                   5.0                                        5

P4                                   7.0                                        6

P5                                   9.0                                        1

All the processes are preemptive. Show your show solution in Gantt chart for SJF Scheduling and calculate the average waiting time.

Explanation / Answer

Microcomputer Operating

1. Suppose there are 5 jobs in the ready queue. Processes’ arrival time and burst time are shown as below:

Process                    Arrival Time                        Burst Time

P1                                   0.0                                       11

P2                                   4.0                                        8

P3                                   5.0                                        5

P4                                   7.0                                        6

P5                                   9.0                                        1

All the processes are non-preemptive. Show your show solution in Gantt chart for SJF Scheduling and calculate the average waiting time.

Solution :

----------------------------------------------------------------------------------------
|      P1            |   p5 | p3     | p4                   |     P2                    |                                                  |
|                    |      |         |                      |                           |  
----------------------------------------------------------------------------------------
0                   11     12         17                     23                         31

Avg Time is :
P1 Wait Time : 0
P2 Wait Time : 23 - 8 = 15
P3 Wait Time : 12 - 5 = 7
P4 Wait Time : 17 - 6 = 11
P5 Wait Time : 11 - 1 = 10

Total Avg Time is : (0 + 15 + 7 + 11 +10) / 5 = 8.6





2. Suppose there are 5 jobs in the ready queue. Processes’ arrival time and burst time are shown as below:

Process                    Arrival Time                        Burst Time          

P1                                   0.0                                       11          11-4 = 7

P2                                   4.0                                        8          8- 1 = 7

P3                                   5.0                                        5          5 - 2 = 3

P4                                   7.0                                        6          7 - 2 = 5

P5                                   9.0                                        1           0

All the processes are preemptive. Show your show solution in Gantt chart for SJF Scheduling and calculate the average waiting time.

Solution :

Remaining Time      Wait Time
-----------------------------------------------
| P1 | P2 | P3 | P3 | P5 | P4 | P2   | P1     |
|    |    |    |    |    |     |      |        |                                                     |
-----------------------------------------------
0   4     5    7    9   10     15     22     29

Waiting Time :
P1 Waiting Time : End Of P1 Process time Complete - Beginning Time of P1 Process Next time In chat = 22 - 4 = 18
P2 Waiting Time : End Of P2 Process time Complete - Beginning Time of P2 Process Next time In chat = 15 - 5 = 10
P3 Waiting Time : End Of P3 Process time Complete - Beginning Time of P3 Process Next time In chat = 2
P4 Waiting Time : 5
P5 Waiting Time : 0

Total Avg Time is : ( 18 + 10 + 2 + 5+ 0) / 5 = 7