-
[CS] ์ค์ผ์ค๋ง๐ฅCS 2022. 1. 24. 23:23
1. ์ค์ผ์ค๋ง์ ๋ชฉ์
๋ฉํฐํ๋ก๊ทธ๋๋ฐ (Multi-programming)
- ์ฌ๋ฌ ๊ฐ์ ํ๋ก์ธ์ค๊ฐ ์์คํ ๋ด์ ์กด์ฌํ๋ค.
- ์์์ ํ ๋นํ ํ๋ก์ธ์ค๋ฅผ ์ ํํ๋ ๊ฒ์ด ์ค์ผ์ค๋ง (Scheduling)
- ์์ ๊ด๋ฆฌ
- ์๊ฐ ๋ถํ (time sharing) ๊ด๋ฆฌ
- ํ๋์ ์์์ ์ฌ๋ฌ ์ค๋ ๋๋ค์ด ๋ฒ๊ฐ์๊ฐ๋ฉฐ ์ฌ์ฉ
- ex) ํ๋ก์ธ์ (Processor)
- ํ๋ก์ธ์ค ์ค์ผ์ค๋ง (Process Scheduling)
- ๊ณต๊ฐ ๋ถํ (space sharing) ๊ด๋ฆฌ
- ํ๋์ ์์์ ๋ถํ ํ์ฌ ๋์์ ์ฌ์ฉ
- ex) ๋ฉ๋ชจ๋ฆฌ (Memory)
ใ ค
- ์๊ฐ ๋ถํ (time sharing) ๊ด๋ฆฌ
์ค์ผ์ค๋ง (Scheduling)์ ๋ชฉ์
- ์์คํ ์ ์ฑ๋ฅ (Performance) ํฅ์
- ๋ํ์ ์์คํ
์ฑ๋ฅ ์งํ (index)
- ์๋ต ์๊ฐ (response time)
- ์์ ์์ฒญ (submission)์ผ๋ก๋ถํฐ ์๋ต์ ๋ฐ์ ๋๊น์ง์ ์๊ฐ
- ์์
์ฒ๋ฆฌ๋ (throughput)
- ๋จ์ ์๊ฐ ๋์ ์๋ฃ๋ ์์ ์ ์
- ์์ ํ์ฉ๋ (resource utilization)
- ์ฃผ์ด์ง ์๊ฐ (Tc) ๋์ ์์์ด ํ์ฉ๋ ์๊ฐ (Tr)
- Utilization = Tr / Tc
- ์๋ต ์๊ฐ (response time)
- ๋ชฉ์ ์ ๋ง๋ ์งํ๋ฅผ ๊ณ ๋ คํ์ฌ ์ค์ผ์ค๋ง ๊ธฐ๋ฒ์ ์ ํ
ใ ค
์์คํ ์ฑ๋ฅ ์งํ๋ค
- ํ๊ท ์๋ต ์๊ฐ (mean response time)
- ์ฌ์ฉ์ ์งํฅ์ . ex) Interactive, real-time system์์ ์ค์ํ ์งํ.
- ์ฒ๋ฆฌ๋ (throughput)
- ์์คํ ์งํฅ์ . ex) batch system ๋ฑ ์ผ๊ด ์ฒ๋ฆฌ ์์คํ ์์ ์ค์ํ ์งํ.
- ์์ ํ์ฉ๋ (resource utilization)
- ๊ณตํ์ฑ (fairness)
- ex) FIFO
- ์คํ ๋๊ธฐ ๋ฐฉ์ง
- ๋ฌด๊ธฐํ ๋๊ธฐ ๋ฐฉ์ง
- ์์ธก ๊ฐ๋ฅ์ฑ (predictability)
- ์ ์ ํ ์๊ฐ ์์ ์๋ต์ ๋ณด์ฅํ๋๊ฐ?
- ์์ ํ ๋น์ ๊ณต์ ์ฑ ๋ณด์ฅ
- ๋จ์ ์๊ฐ ๋น ์ฒ๋ฆฌ๋ ์ต๋ํ
- ์ ์ ํ ๋ฐํ์๊ฐ ๋ณด์ฅ
- ์ค๋ฒํค๋ ์ต์ํ
- ์์ ์ฌ์ฉ์ ๊ท ํ ์ ์ง
- ๋ฐํ์๊ฐ๊ณผ ์์์ ํ์ฉ ๊ฐ์ ๊ท ํ ์ ์ง
- ์ฐ์ ์์
- ์๋น์ค ์ฌ์ฉ ๊ธฐํ ํ๋
- ์๋น์ค ์ ๊ฐ์ ๋ฐฉ์ง
ใ ค
๋๊ธฐ ์๊ฐ, ์๋ต ์๊ฐ, ๋ฐํ ์๊ฐ
ใ
ค
ใ
ค
2. ์ค์ผ์ค๋ง ๊ธฐ์ค ๋ฐ ๋จ๊ณ
์ค์ผ์ค๋ง ๊ธฐ์ค (Criteria)
์ค์ผ์ค๋ง ๊ธฐ๋ฒ์ด ๊ณ ๋ คํ๋ ํญ๋ชฉ๋ค
- ํ๋ก์ธ์ค์ ํน์ฑ
- I/O-bounded or compute-bounded
- ์์คํ
ํน์ฑ
- Batch system or interactive system
- ํ๋ก์ธ์ค์ ๊ธด๊ธ์ฑ (urgency)
- Hard- or Soft- real time, non-real time systems
- ํ๋ก์ธ์ค ์ฐ์ ์์ (priority)
- ํ๋ก์ธ์ค ์ด ์คํ ์๊ฐ (total service time)
ใ ค
CPU burst vs I/O burst
- ํ๋ก์ธ์ค ์ํ = CPU ์ฌ์ฉ + I/O ๋๊ธฐ
- CPU burst: CPU ์ฌ์ฉ ์๊ฐ
- CPU burst time์ด ๊ธด ๊ฒฝ์ฐ๋ฅผ compute bounded ํ๋ก์ธ์ค๋ผ๊ณ ํ๋ค.
- I/O burst: I/O ๋๊ธฐ ์๊ฐ
- I/O burst time์ด ๊ธด ๊ฒฝ์ฐ๋ฅผ I/O bounded ํ๋ก์ธ์ค๋ผ๊ณ ํ๋ค.
- Burst time์ ์ค์ผ์ค๋ง์ ์ค์ํ ๊ธฐ์ค ์ค ํ๋
ใ ค
์ค์ผ์ค๋ง์ ๋จ๊ณ (Level)
- ๋ฐ์ํ๋ ๋น๋ ๋ฐ ํ ๋น ์์์ ๋ฐ๋ฅธ ๊ตฌ๋ถ.
- Long-term Scheduling
- ์ฅ๊ธฐ ์ค์ผ์ค๋ง
- Job Scheduling
- Mid-term Scheduling
- ์ค๊ธฐ ์ค์ผ์ค๋ง
- Memory allocation
- Short-term Scheduling
- ๋จ๊ธฐ ์ค์ผ์ค๋ง
- Process Scheduling
ใ ค
Long-term Scheduling
- Job Scheduling
- Job์ด Kernel์ ๋ฑ๋ก๋๋ฉด ํ๋ก์ธ์ค๊ฐ ๋๋ค.
- ์์คํ ์ ์ ์ถํ (Kernel์ ๋ฑ๋กํ ) ์์ (Job) ๊ฒฐ์
- Admission Scheduling, High-level Scheduling
- ๋ค์คํ๋ก๊ทธ๋๋ฐ ์ ๋ (degree) ์กฐ์
- ์์คํ ๋ด์ ํ๋ก์ธ์ค ์ ์กฐ์
- I/O-bounded์ compute-bounded ํ๋ก์ธ์ค๋ค์ ์ ์์ด์ ์ ํํด์ผํจ
- ๋ ํ๋ก์ธ์ค๋ฅผ ์ ์ ํ ์์ด์ ์ ํํด์ผ, ์์คํ ์ด ํจ์จ์ ์ผ๋ก ๋์๊ฐ๋ค.
- ์๋ถํ ์์คํ
์์๋ ๋ชจ๋ ์์
์ ์์คํ
์ ๋ฑ๋ก
ใ ค
Mid-term Scheduling
- ๋ฉ๋ชจ๋ฆฌ ํ ๋น ๊ฒฐ์ (memory allocation)
- Intermediate-level scheduling
- Swapping (swap-in/swap-out)
ใ ค
Short-term Scheduling
- Process scheduling
- Low-level scheduling
- ํ๋ก์ธ์๋ฅผ ํ ๋นํ ํ๋ก์ธ์ค๋ฅผ ๊ฒฐ์
- Process scheduler, dispatcher
- ๊ฐ์ฅ ๋น๋ฒํ๊ฒ ๋ฐ์
- Interrupt, block (I/O), time-out ๋ฑ
- ๋งค์ฐ ๋นจ๋ผ์ผํ๋ค.
ใ ค
ใ ค
3. ์ค์ผ์ค๋ง ์ ์ฑ (Policy)
- ์ ์ vs ๋น์ ์
- Preemptive scheduling, Non-preemptive scheduling
- ์ฐ์ ์์
- Priority
ใ ค
- Priority
Preemptive/Non-preemtive scheduling
- Non-preemtive scheduling (๋น์ ์ ์ค์ผ์ค๋ง)
- ํ ๋น ๋ฐ์ ์์์ ์ค์ค๋ก ๋ฐ๋ฉํ ๋๊น์ง ์ฌ์ฉ
- ex) system call, I/O ๋ฑ
- ์ฅ์
- Context switch overhead๊ฐ ์ ๋ค.
- ๋จ์
- ์ฆ์ ์ฐ์ ์์ ์ญ์ (์ฐ์ ์์๊ฐ ๋์ ํ๋ก์ธ์ค๋ฅผ ์คํํ์ง ๋ชปํ๋ ๊ฒฝ์ฐ ๋ฐ์), ํ๊ท ์๋ต ์๊ฐ ์ฆ๊ฐ
- ํ ๋น ๋ฐ์ ์์์ ์ค์ค๋ก ๋ฐ๋ฉํ ๋๊น์ง ์ฌ์ฉ
- Preemptive scheduling (์ ์ ์ค์ผ์ค๋ง)
- ํ์์ ์ํด ์์์ ๋นผ์๊ธธ ์ ์์
- ex) ํ ๋น ์๊ฐ ์ข ๋ฃ, ์ฐ์ ์์๊ฐ ๋์ ํ๋ก์ธ์ค ๋ฑ์ฅ
- Context switch overhead๊ฐ ํผ (ํ๋ก์ธ์ค๊ฐ ์์ฃผ ๋ฐ๋ ์ ์๋ค.)
- Time-sharing system, real-time system ๋ฑ์ ์ ํฉ.
ใ ค
- ํ์์ ์ํด ์์์ ๋นผ์๊ธธ ์ ์์
Priority (ํ๋ก์ธ์ค์ ์ค์๋)
- Static priority (์ ์ ์ฐ์ ์์)
- ํ๋ก์ธ์ค ์์ฑ ์ ๊ฒฐ์ ๋ priority๊ฐ ์ ์ง๋จ
- ๊ตฌํ์ด ์ฝ๊ณ , overhead๊ฐ ์ ์
- ์์คํ ํ๊ฒฝ ๋ณํ์ ๋ํ ๋์์ด ์ด๋ ค์
- Dynamic priority (๋์ ์ฐ์ ์์)
- ํ๋ก์ธ์ค์ ์ํ ๋ณํ์ ๋ฐ๋ผ priority ๋ณ๊ฒฝ
- ๊ตฌํ์ด ๋ณต์กํ๊ณ , priority๋ฅผ ์ฌ๊ณ์ฐํ๋ฏ๋ก overhead๊ฐ ํผ
- ์์คํ
ํ๊ฒฝ ๋ณํ์ ๋ํ ์ ์ฐํ ๋์ ๊ฐ๋ฅ
ใ ค
ใ ค
[OS] Lecture 5. Process Scheduling (1/4) / ์ด์์ฒด์ ๊ฐ์
'๐ฅCS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CS] ํ๋ก์ธ์ค ๋ฉ๋ชจ๋ฆฌ ๊ตฌ์กฐ (0) 2022.01.18