Each section shows how several process scheduling algorithms would execute the processes.
This policy services processes in the order they start.
| process name | arrival time | service time | start time | finish time | turnaround time | waiting time | response time |
|---|---|---|---|---|---|---|---|
| A | 0 | 10 | 0 | 10 | 10 | 0 | 1.0 |
| B | 1 | 29 | 10 | 39 | 38 | 9 | 1.3 |
| C | 2 | 3 | 39 | 42 | 40 | 37 | 13.3 |
| D | 3 | 7 | 42 | 49 | 46 | 39 | 6.6 |
| E | 4 | 12 | 49 | 61 | 57 | 45 | 4.8 |
| mean | 38.2 | 26 | 5.4 |
In what follows, the number in parentheses in the comment field is the remaining service time for the process. In order of execution:
| time | ready queue | comments |
|---|---|---|
| 0 | A | A(10) arrives, runs |
| 1 | AB | B(29) arrives, A(9) is not interrupted and continues to run |
| 2 | ABC | C(3) arrives and is appended to the queue; again, A(8) continues to run |
| 3 | ABCD | D(7) arrives and is appended to the queue; again, A(7) continues to run |
| 4 | ABCDE | E(12) arrives and is appended to the queue; again, A(6) continues to run |
| 10 | BCDE | A finishes, B(29) runs |
| 39 | CDE | B finishes, C(3) runs |
| 42 | DE | C finishes, D(7) runs |
| 49 | E | D finishes, E(12) runs |
| 61 | — | E finishes |
This policy services the process with the shortest service time next. It is sometimes also called “shortest job next” (SJN).
| process name | arrival time | service time | start time | finish time | turnaround time | waiting time | response time |
|---|---|---|---|---|---|---|---|
| A | 0 | 10 | 0 | 10 | 10 | 0 | 1.0 |
| B | 1 | 29 | 32 | 61 | 60 | 31 | 2.1 |
| C | 2 | 3 | 10 | 13 | 11 | 8 | 3.7 |
| D | 3 | 7 | 13 | 20 | 17 | 10 | 2.4 |
| E | 4 | 12 | 20 | 32 | 28 | 16 | 2.3 |
| mean | 25.2 | 13 | 2.3 |
In what follows, the number in parentheses in the comment field is the remaining service time for the process. In order of execution:
| time | ready queue | comments |
|---|---|---|
| 0 | A | A(10) arrives, runs |
| 1 | AB | B(29) arrives, A(9) continues to run |
| 2 | ABC | C(3) arrives and is appended to the queue; again, A(8) continues to run |
| 3 | ABCD | D(7) arrives and is appended to the queue; again, A(7) continues to run |
| 4 | ABCDE | E(12) arrives and is appended to the queue; again, A(6) continues to run |
| 10 | BCDE | A finishes; C(3) has the shortest service time, so it runs |
| 13 | BDE | C finishes, D(7) has the shortest service time, so it runs |
| 20 | BE | D finishes, E(12) runs |
| 32 | B | E finishes, B(29) runs |
| 61 | — | B finishes |
This policy services the process with the shortest service time next. It is sometimes also called “preemptive shortest job next” (PSJN).
| process name | arrival time | service time | start time | finish time | turnaround time | waiting time | response time |
|---|---|---|---|---|---|---|---|
| A | 0 | 10 | 0 | 2 | preempted by C | ||
| 8 | 12 | 20 | 20 | 10 | 2.0 | ||
| B | 1 | 29 | 32 | 61 | 60 | 31 | 2.1 |
| C | 2 | 3 | 2 | 5 | 3 | 0 | 1.0 |
| D | 3 | 7 | 5 | 12 | 9 | 2 | 1.3 |
| E | 4 | 12 | 20 | 32 | 28 | 16 | 2.3 |
| <mean> | 24 | 11.8 | 1.7 | ||||
In what follows, the number in parentheses in the comment field is the remaining service time for the process. In order of execution:
| time | ready queue | comments |
|---|---|---|
| 0 | A | A(10) arrives, runs |
| 1 | AB | B(29) arrives; as its service time is greater than that of A(9), B is appended to the queue and |
| A continues to run | ||
| 2 | CAB | C(3) arrives; as its service time is less than that of A(8), C runs. A’s service time is less than |
| that of B(29), so it goes before B in the queue | ||
| 3 | CDAB | D(7) arrives; as its service time is greater than that of C(2), D is placed in the queue at the |
| appropriate place, and C continues to run | ||
| 4 | CDAEB | E(12) arrives; as its service time is greater than that of C(1), E is placed in the queue at the |
| appropriate place, and C continues to run | ||
| 5 | DAEB | C finishes; D(7) has the shortest remaining service time, so it runs |
| 12 | AEB | D finishes, A(8) has the shortest remaining service time, so it runs |
| 20 | EB | A finishes, E(12) has the shortest remaining service time, so it runs |
| 32 | B | E finishes, B(29) has the shortest remaining service time, so it runs |
| 61 | — | B finishes |
This policy services the process with the greatest (highest) response ratio next.
| process name | arrival time | service time | start time | finish time | turnaround time | waiting time | response ratio |
|---|---|---|---|---|---|---|---|
| A | 0 | 10 | 0 | 10 | 10 | 0 | 1.0 |
| B | 1 | 29 | 32 | 61 | 60 | 31 | 2.1 |
| C | 2 | 3 | 10 | 13 | 11 | 8 | 3.7 |
| D | 3 | 7 | 13 | 20 | 17 | 10 | 2.4 |
| E | 4 | 12 | 20 | 32 | 28 | 16 | 2.3 |
| mean | 25.2 | 13 | 2.3 |
In order of execution:
|
ECS 150, Operating Systems Version of April 17, 2022 at 9:03PM
|
You can also obtain a PDF version of this. |