In: Computer Science
Consider the following set of processes, with the length of the CPU burst given in milliseconds:
Process |
Burst Time |
Priority |
P1 |
2 |
2 |
P2 |
1 |
1 |
P3 |
8 |
4 |
P4 |
4 |
2 |
P5 |
5 |
3 |
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, non preemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 2).
FCFS Gantt chart
The processes are have arrived in the order P1, P2, P3, P4, P5, all at time 0.
first come, first served (FCFS) P1 first came,then P2, then P3, then P4, last one is P5
SJF Gantt chart
Shortest job first (SJF) is selects the waiting process with the smallest execution time to execute next.
P2 brust time is 1
P1 brust time is 2
P4 brust time is 4
P5 brust time is 5
P3 brust time is 8
Non preemptive priority Gantt chart (a smaller priority number implies a higher priority)
P1 and P4 have same priority. P1 execute first, Then P4.
P2 priority 1
P1 priority 2
P4 priority 2
P5 priority 3
P3 priority 4
Round Robin (quantum = 2) Gantt chart
Round Robin : each process is assigned a fixed time slot in a cyclic way.
Each process have 2 millisecond of time. Reapeat the cycle until complete all processes.