CPU Scheduling Algorithm

Assumption

為了簡化討論,我們有以下假設:

  1. 只有單一 processor,因此一次至多跑一個 process
  2. Scheduler 在排程前就知道每個 process 的 CPU burst time 需要多少時間
  3. 所有 Ready process 都在 ready queue 中乖乖排隊

Nonpreemptive Scheduling

1. First Come First Serve (FCFS) Scheduling

D-OS-Ch05ea-FCFS_Scheduling

2. Shortest-Job-First (SJF) Scheduling

D-OS-Ch05eb-SJF_Scheduling

Preemptive Scheduling

1. Shortest-Remaining-Time-First (SRTF) Scheduling

D-OS-Ch05ec-SRTF_Scheduling

可以想成 preemptive 版本的 SJF

2. Round-Robin (RR) Scheduling

D-OS-Ch05ed-RR_Scheduling

Priority Scheduling

D-OS-Ch05ee-Priority_Scheduling

Proportional Share Scheduling

D-OS-Ch05ef-Proportional_Share_Scheduling

Real-Time CPU Scheduling

real-time CPU scheduling