<aside>
📌 CPU and I/O Bursts in Program Execution, CPU-burst Time의 분포, CPU Scheduler & Dispatcher, Scheduling Algorithms, Scheduling Criteria, FCFS(First- Come First-Served), SJF(Shortest-Job-First), Example of Non-Preemptive SJF, Example of Preemptive SJF, 다음 CPU Burst Time의 예측, Exponential Averaging, Priority Scheduling, Round Robin(RR), Example: RR with Time Quantum = 20, Turmaround Time Varies With Time Quantum
</aside>
CPU and I/O Bursts in Program Execution
-
프로그램이 실행되면 어떤 프로그램이든 그림 왼쪽과 같은 경로(기계어)를 가지고 실행 됨
-
CPU만 연속적으로 쓰는 단계(CPU-burst
)와 I/O만 실행하는 단계(I/O-burst
)가 반복됨
- 누구에게 CPU를 줄지 결정하는 것 → Scheduler

I/O가 잦은 개입을 하는 프로그램 (Interactive함)
CPU-burst Time의 분포
프로세스의 특성 분류
- 프로세스는 그 특성에 따라 다음 두 가지로 나눔
- I/O-bound process
- CPU를 잡고 계산하는 시간보다 I/O에 많은 시간이 필요한 job
- 사람하고 인터랙션하는 job
- many + short CPU burst
- CPU-bound process
- 계산 위주의 job
- few + very long CPU burst
CPU Scheduler & Dispatcher
Scheduling Criteria
1. Performance Index (== Performance Measure, 성능 척도)
- 시스템 입장에서의 성능 척도
- CPU utilization (이용률)
- keep the CPU as busy as possible
- 전체 시간 중에서 CPU가 놀지 않고 일한 시간의 비율
- Throughput (처리량)
- number of processes that complete their execution per time until
- 주어진 시간 동안에 몇 개의 작업을 완료했는가
- process 하나를 완료한 것 X, burst 각각의 건을 따져야 함
- 프로세스(프로그램) 입장에서의 성능 척도 (시간이 중요)
- Turnaround Time (소요 시간, 반환 시간)
- amount of time to execute a particular process
- CPU를 쓰러 들어가서(Ready Queue), 다 쓰고 나가는 데 걸린 시간 (대기 시간 + 처리 시간)
- process 하나를 완료한 것 X, burst 각각의 건을 따져야 함
- Waiting time (대기 시간)
- amount of time a process has been waiting in the ready queue
- CPU를 쓰지 못 하고 Ready Queue에서 기다린 시간
- 선점형 스케줄링에서는 CPU를 얻었다 뺐겼다 하기 때문에 각각의 기다린 시간이 모두 포함됨
- Response time (응답 시간)
- amout of time it takes from when a request was submitted until the first response is produced. not output (for time-sharing environment)
- CPU를 처음으로 얻기 까지 걸린 시간
- 선점형 스케줄링에서 CPU를 얻었다 뺐겼다 할 때도 시간이 바뀌지 않음
Scheduling Algorithms
1. FCFS (First-Come First-Served)
2. SJF (Shortest-Job-First)
- 각 프로세스의 다음번 CPU burst time을 가지고 스케줄링에 활용
- CPU burst time이 가장 짧은 프로세스를 제일 먼저 스케줄
- Two schemes:
- SJF is optimal → Preemtive 버전에 대해 얘기하는 것
- 문제점
- Example
3. SRTF (Shortest-Remaining-Time-First)
4. Priority Scheduling
- A priority number(integer) is associated with each process
- highest priority를 가진 프로세스에게 CPU 할당 (smallest integer == highest integer)
- SJF는 일종의 priority scheduling이라고 볼 수 있음
- 문제점
- 해결 방법
5. RR (Round Robin)
- 컴퓨터 시스템에서 사용하는 스케줄링은 여기에 기반하고 있음
다음 CPU Burst Time의 예측
- 다음번 CPU burst time을 어떻게 알 수 있는가?
(input data, branch, user, …)