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

Recall that Shortest Remaining Time First (SRTF) is a variant of Shortest Job Fi

ID: 3856365 • Letter: R

Question

Recall that Shortest Remaining Time First (SRTF) is a variant of Shortest Job First (SJF) with preemption added in. Consider the following three processes

for the CPU. The scheduler uses SRTF. The scheduler re-evaluates which process to run only upon the arrival of a new process into the

scheduling queue, or the completion of a process. The table shows the arrival time of each process.

Process

Arrival Time

Execution Time

P1

T0

5 ms

P2

T0 + 2 ms

4 ms

P3

T0 + 3 ms

1 ms

The scheduling starts at time T0.

Fill up the blank cell/cells in the table below with the appropriate time information.

(a) At time T0: (2 points)

Process

Remaining Time

P1

P2

Not Arrived Yet

P3

Not Arrived Yet

(b) At time T0 + 2 ms : (Process P2 arrives) (4 points)

Process

Remaining Time

P1

P2

P3

Not Arrived Yet

(c) At time T0 + 3 ms: (Process P3 arrives) (4 points)

Process

Remaining Time

P1

P2

P3

(d) Fill in the table below with the process that is executing on the processor during each time slot (the first slot has been filled up with Process P1). (10 points)

Interval T0 +

0 ms

1 ms

2 ms

3 ms

4 ms

5 ms

6 ms

7 ms

8 ms

9 ms

10 ms

11 ms

12 ms

Running Process

P1

Process

Arrival Time

Execution Time

P1

T0

5 ms

P2

T0 + 2 ms

4 ms

P3

T0 + 3 ms

1 ms

Explanation / Answer

A)

PROCESS

REMAINING TIME

P1

5ms

P2

NOT ARRIVED YET

P3

NOT ARRIVED YET

Process p1 just arrived but complete execution left

B)

PROCESS

REMAINING TIME

P1

3ms

P2

4ms

P3

NOT ARRIVED YET

After 2 s , process p1 compete its 2ms execution and left is 3ms.

Process p2 just arrived so complete execution left

C)

PROCESS

REMAINING TIME

P1

2ms

P2

4ms

P3

1ms

After 2 s , process p1 compete its 2ms execution and left is 3ms .

Process p2 just arrived at 2ms but completion time for p1 is less than p2, so p1 will execute and after 3ms, p1 remaining time is 2ms.

Process p2 compete un utilized so execution time is 4ms

Process p3 just arrived so complete execution left

Interval time

0 ms

1 ms

2m

3ms

4ms

5ms

6ms

7ms

8ms

9ms

10ms

11ms

12ms

Running process

P1

P1

P1

P3

P1

P1

P1

P2

P2

P2

P2

PROCESS

REMAINING TIME

P1

5ms

P2

NOT ARRIVED YET

P3

NOT ARRIVED YET