๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป CS/์šด์˜์ฒด์ œ

[์šด์˜์ฒด์ œ] 5. CPU Scheduling

by nitronium102 2022. 11. 27.

ํ”„๋กœ์„ธ์Šค์˜ ํŠน์„ฑ ๋ถ„๋ฅ˜

  • CPU-bound process
    • CPU๋ฅผ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ์„ธ์Šค(high CPU)
    • ๊ณ„์‚ฐ ์œ„์ฃผ์˜ job
    • few very long CPU burst(CPU-intensive)
  • I/O-bound process
    • CPU๋ฅผ ์žก๊ณ  ๊ณ„์‚ฐํ•˜๋Š” ์‹œ๊ฐ„๋ณด๋‹ค I/O์— ๋งŽ์€ ์‹œ๊ฐ„์ด ํ•„์š”ํ•œ process(low CPU)
    • interactive program
    • many short CPU bursts(์ค‘๊ฐ„์— I/O๊ฐ€ ๋ผ์–ด๋“ฆ)

 

CPU-burst Time์˜ ๋ถ„ํฌ

  • ์—ฌ๋Ÿฌ ์ข…๋ฅ˜์˜ job/process์ด ์„ž์—ฌ์žˆ๊ธฐ ๋•Œ๋ฌธ์— CPU ์Šค์ผ€์ค„๋ง์ด ํ•„์š”ํ•˜๋‹ค
  • interactive job(I/O bound job)์—๊ฒŒ ์ ์ ˆํ•œ response๋ฅผ ์šฐ์„ ์ ์œผ๋กœ ์ œ๊ณต
  • CPU์™€ I/O ์žฅ์น˜ ๋“ฑ ์‹œ์Šคํ…œ ์ž์›์„ ๊ณจ๊ณ ๋ฃจ ํšจ์œจ์ ์œผ๋กœ ์‚ฌ์šฉ

 

CPU Scheduler & Dispatcher

1) CPU scheduler (OS ๋‚ด๋ถ€ ์ฝ”๋“œ)

ready ์ƒํƒœ์˜ ํ”„๋กœ์„ธ์Šค ์ค‘์—์„œ ์ด๋ฒˆ์— CPU๋ฅผ ์ค„ ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ณ ๋ฅธ๋‹ค

 

2) Dispatcher (OS ๋‚ด๋ถ€ ์ฝ”๋“œ)

context switch - CPU์˜ ์ œ์–ด๊ถŒ์„ CPU scheduler์— ์˜ํ•ด ์„ ํƒ๋œ ํ”„๋กœ์„ธ์Šค์—๊ฒŒ ๋„˜๊ธด๋‹ค

 

CPU Scheduling์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ

  • Running -> Blocked (I/O ์š”์ฒญ ์‹œ์Šคํ…œ ์ฝœ) : nonpreemtive
  • Running -> Ready (ํ• ๋‹น ์‹œ๊ฐ„ ๋งŒ๋ฃŒ๋กœ timer interrupt) : preemtive
  • Blocked -> Ready (I/O ์™„๋ฃŒ ํ›„ ์ธํ„ฐ๋ŸฝํŠธ) : preemtive
  • Terminate : nonpreemtive

 

  • nonpreemtive : ์ž์ง„ ๋ฐ˜๋‚ฉ - ์‹œ์Šคํ…œ์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด๋„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ
  • preemtive : ๊ฐ•์ œ๋กœ ๋นผ์•—์Œ

๋Œ“๊ธ€