Escalonamento
Introduzido| English | Significado |
|---|---|
| FCFS | FCFS |
| SJF | SJF |
| round robin/raʊnd ˈrɒbɪn/ | round robin |
| Gantt chart/ɡænt tʃɑːt/ | Gantt chart |
| turnaround time | turnaround time |
| waiting time | waiting time |
Three policies, one job set
- The course set: bursts P1 = 7, P2 = 4, P3 = 1, P4 = 4, all arriving at 0. FCFS runs them in order; SJF runs the shortest next; round robin (quantum 2) slices everyone in turn — the Gantt chart shows who ran when.

{exercise:uni-cs0702-policies}
For the course set (7, 4, 1, 4 at time 0), the policy with the LOWEST average turnaround is —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
SJF averages 7.75 against FCFS 11.5 and RR 11.25.
The formula, the numbers
- Turnaround time = finish − arrival; waiting time = turnaround − burst. FCFS finishes $7, 11, 12, 16$ — average turnaround $11.5$. SJF (P3, P2, P4, P1) finishes $1, 5, 9, 16$ — average $7.75$.
- RR ($q = 2$) runs P1 P1 | P2 P2 | P3 | P4 P4 | P1 P1 | P2 P2 | P4 P4 | P1 P1 | P1 — finishes P3 $= 5$, P2 $= 11$, P4 $= 13$, P1 $= 16$: average $11.25$. Same jobs, three answers.
{exercise:uni-cs0702-numbers}
Under FCFS the set finishes at —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
First-come first-served: cumulative bursts 7, 11, 12, 16.
Convoys and quanta
- The convoy effect: under FCFS a 7-burst job arrives first and P3 waits $11$ units for $1$ unit of work — FCFS's signature failure with interactive users.
- Quantum choice: $q$ large degenerates to FCFS; $q$ tiny spends the CPU switching — a $1$ µs switch in a $2$ ms quantum wastes $0.05\%$, in a $20$ µs quantum $5\%$. Switches are work, not progress.
{exercise:uni-cs0702-quantum}
A 1 µs switch in a 20 µs quantum wastes —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
1 µs / 20 µs = 5% — quanta too small spend the CPU on switching.