process scheduling - 2

Jeong seulhoยท2023๋…„ 1์›” 23์ผ
0

์šด์˜์ฒด์ œ

๋ชฉ๋ก ๋ณด๊ธฐ
8/35

๐Ÿ“Œ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜

๐Ÿ“–FCFS(first-come-first-service)

๐Ÿ”๊ฐœ๋…

  • non-preemptive sheduling
  • ์Šค์ผ€์ค„๋ง ๊ธฐ์ค€ : ์„ ์ฐฉ์ˆœ์œผ๋กœ ์ฒ˜๋ฆฌ(ready queue ๊ธฐ์ค€)

โœ๏ธํŠน์ง•

  • high resource utilization(high Tr/Tc) ์ฆ‰, scheduling overhead๊ฐ€ ๋‚ฎ๋‹ค.
  • batch system์— ์ ํ•ฉ / interactive system์— ๋ถ€์ ํ•ฉ
  • ๊ธด ํ‰๊ท  ์‘๋‹ต์‹œ๊ฐ„
  • convoy effect
    • ๋‚˜๋Š” 1์ดˆ๋ฉด ๋๋‚˜๋Š” ์ž‘์—…์ธ๋ฐ ๋‚ด์•ž์— 10์ดˆ๊ฑธ๋ฆฌ๋Š” ์ž‘์—…์ด ์ง„ํ–‰์ค‘์ด๋ผ ๊ธฐ๋‹ค๋ฆผ
    • ์ˆ˜ํ–‰์‹œ๊ฐ„์ด ๊ธด ํ”„๋กœ์„ธ์Šค์— ์˜ํ•ด ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๋“ค์ด ๊ธด ๋Œ€๊ธฐ์‹œ๊ฐ„์„ ๊ฐ–๊ฒŒ ๋˜๋Š” ํ˜„์ƒ

๐Ÿ“–RR(round-robin)

๐Ÿ”๊ฐœ๋…

  • preemptive sheduling
  • ์Šค์ผ€์ค„๋ง ๊ธฐ์ค€ : ์„ ์ฐฉ์ˆœ์œผ๋กœ ์ฒ˜๋ฆฌ(ready queue ๊ธฐ์ค€)
  • ๋‹จ, ์ž์› ์‚ฌ์šฉ์ œํ•œ์‹œ๊ฐ„(time quantum)์ด ์กด์žฌํžˆ๋ฉฐ ํ”„๋กœ์„ธ์Šค๋Š” ํ• ๋‹น๋œ ์‹œ๊ฐ„์ด ์ง€๋‚˜๋ฉด ์ž์› ๋ฐ˜๋‚ฉ

โœ๏ธํŠน์ง•

  • ํŠน์ • ํ”„๋กœ์„ธ์Šค์˜ ์ž์› ๋…์  ๋ฐฉ์ง€
  • context switch overhead๊ฐ€ ํฌ๋‹ค
  • ๋Œ€ํ™”ํ˜•(interactive), ์‹œ๋ถ„ํ•  ์‹œ์Šคํ…œ์— ์ ํ•ฉ
  • time quantum์ด ์‹œ์Šคํ…œ ์„ฑ๋Šฅ์„ ๊ฒฐ์ •ํ•˜๋Š” ์ค‘์š”ํ•œ ์š”์†Œ
    • time quantum to infinite : ์‚ฌ์‹ค์ƒ FCFS
    • time quantum to zero : processor sharing(ํ”„๋กœ์„ธ์„œ๋ฅผ ๋™์‹œ์— ์“ฐ๋Š” ๋Š๋‚Œ)
      • ์ด๋•Œ ์ฒด๊ฐ ํ”„๋กœ์„ธ์„œ ์†๋„ = ์‹ค์ œ ํ”„๋กœ์„ธ์„œ ์„ฑ๋Šฅ์˜ 1/n
      • ๊ทธ๋Ÿฌ๋‚˜ high context switch overhead

๐Ÿ“–SPN(shortest-process-Next) ๋˜๋Š” SJF(shortest-job-fist)

๐Ÿ”๊ฐœ๋…

  • non preemptive scheduling
  • ์Šค์ผ€์ค„๋ง ๊ธฐ์ค€ : ์‹คํ–‰์‹œ๊ฐ„(burst time)์ด ๊ฐ€์žฅ ์ž‘์€ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋จผ์ € ์ฒ˜๋ฆฌ

โœ๏ธํŠน์ง•

  • ํ‰๊ท  ๋Œ€๊ธฐ์‹œ๊ฐ„(WT) ์ตœ์†Œํ™”
  • ์‹œ์Šคํ…œ ๋‚ด ํ”„๋กœ์„ธ์Šค์ˆ˜ ์ตœ์†Œํ™”
    • ์Šค์ผ€์ค„๋ง ๋ถ€ํ•˜ ๊ฐ์†Œ, ๋ฉ”๋ชจ๋ฆฌ ์ ˆ์•ฝ
  • ๋งŽ์€ ํ”„๋กœ์„ธ์Šค๋“ค์—๊ฒŒ ๋น ๋ฅธ ์‘๋‹ต ์‹œ๊ฐ„ ์ œ๊ณต
  • ๋ฌดํ•œ๋Œ€๊ธฐ ํ˜„์ƒ ๋ฐœ์ƒ : BT(burst time)๊ฐ€ ๊ธด ํ”„๋กœ์„ธ์Šค๋Š” ์ž์›์„ ํ• ๋‹น๋ฐ›์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Œ
  • ์ •ํ™•ํ•œ ์‹คํ–‰์‹œ๊ฐ„(BT)์„ ์•Œ ์ˆ˜ ์—†์Œ : ์‹คํ–‰์‹œ๊ฐ„ ์˜ˆ์ธก ๊ธฐ๋ฒ•์ด ํ•„์š”ํ•˜๋‹ค.

๐Ÿ“–SRTN(shortest-remaining-time-next)

๐Ÿ”๊ฐœ๋…

  • preemptive scheduling
  • ์Šค์ผ€์ค„๋ง ๊ธฐ์ค€ : ์ž”์—ฌ ์‹คํ–‰ ์‹œ๊ฐ„์ด ๋”์ ์€ ํ”„๋กœ์„ธ์Šค๊ฐ€ ready๋˜๋ฉด ์„ ์ 
  • SPN์˜ ๋ณ€ํ˜•

โœ๏ธํŠน์ง•

  • BT์˜ˆ์ธก ํ•„์š”
  • ์ž”์—ฌ์‹คํ–‰์„ ๊ณ„์† ์ถ”์ ํ•จ => overhead
  • context switching overhead

๐Ÿ“–HRRN(high-response-ratio-next)

๐Ÿ”๊ฐœ๋…

  • non preemptive scheduling
  • SPN์˜ ๋ณ€ํ˜• : SPN + aging concepts
    • aging concepts : ํ”„๋กœ์„ธ์Šค ๋Œ€๊ธฐ์‹œ๊ฐ„(WT)๋ฅผ ๊ณ ๋ คํ•˜์—ฌ ๊ธฐํšŒ ์ œ๊ณต
  • ์Šค์ผ€์ค„๋ง ๊ธฐ์ค€ : response ratio๊ฐ€ ๋†’์€ ํ”„๋กœ์„ธ์Šค ์šฐ์„ 
    • response ratio
      • ์‘๋‹ต๋ฅ ( WT+BT / BT )
      • ํ•„์š”ํ•œ ์‹คํ–‰์‹œ๊ฐ„ ๋Œ€๋น„ ์–ผ๋งˆ๋‚˜ ๊ธฐ๋‹ค๋ ธ๋‚˜? ์ง€ํ‘œ

โœ๏ธํŠน์ง•

  • SPN ์žฅ์  + starvation(๋ฌดํ•œ๋Œ€๊ธฐ ํ˜„์ƒ) ๋ฐฉ์ง€
  • ์‹คํ–‰์‹œ๊ฐ„ ์˜ˆ์ธก ๊ธฐ๋ฒ• ํ•„์š” => overhead

๐Ÿ“–MLQ(muilti-level-queue)

๐Ÿ”๊ฐœ๋…

  • ์ž‘์—…๋ณ„ ๋ณ„๋„์˜ ready queue๋ฅผ ๊ฐ€์ง„๋‹ค
    • ์ตœ์ดˆ ๋ฐฐ์ •๋œ queue๋ฅผ ๋ฒ—์–ด๋‚˜์ง€ ์•Š๋Š”๋‹ค
    • ๊ฐ๊ฐ์˜ queue๋Š” ์ž์‹ ๋งŒ์˜ ์Šค์ผ€์ค„๋ง ๊ธฐ๋ฒ• ์‚ฌ์šฉ
  • queue ์‚ฌ์ด์—์„œ๋Š” ์šฐ์„ ์ˆœ์œ„ ๊ธฐ๋ฐ˜์˜ ์Šค์ผ€์ค„๋ง ์‚ฌ์šฉ

โœ๏ธํŠน์ง•

  • ์—ฌ๋Ÿฌ queue๊ด€๋ฆฌ๋กœ overhead
  • ์šฐ์„ ์ˆœ์œ„ ๋‚ฎ์€ queue๋Š” startvation ๋ฐœ์ƒ

๐Ÿ“–MFQ(muilti-level-feedback-queue)

๐Ÿ”๊ฐœ๋…

  • preemptive scheduling
  • ํ”„๋กœ์„ธ์Šค queue๊ฐ„ ์ด๋™์ด ํ—ˆ์šฉ๋œ MLQ
  • feedback์„ ํ†ตํ•ด ์šฐ์„ ์ˆœ์œ„ ์กฐ์ •

โœ๏ธํŠน์ง•

  • dynamic priority
  • favor short BT processes ๋˜๋Š” favor I/O bounded processes
  • improve adaptability : ๊ฐ ํ์˜ ์‹œ๊ฐ„ ํ• ๋‹น๋Ÿ‰ ์กฐ์ ˆ๋กœ ํ”„๋กœ์„ธ์Šค ํŠน์„ฑ์— ๋งž๊ฒŒ ์‹œ์Šคํ…œ ์šด์˜
  • BT๋ฅผ ์˜ˆ์ธกํ•˜์ง€ ์•Š์•„๋„ SPN, SRTN, HRRN์˜ ํšจ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.
  • ์„ค๊ณ„, ๊ตฌํ˜„์ด ๋ณต์žกํ•˜๋‹ค
  • overhead ํฌ๋‹ค, starvation ๋ฐœ์ƒ

โœ๏ธqueue๊ฐ„์˜ ์šฐ์„ ์ˆœ์œ„ ๊ฒฐ์ • ๋ฐฉ๋ฒ•

  1. I/O bounded processes
    ์ž…์ถœ๋ ฅ ์œ„์ฃผ ํ”„๋กœ์„ธ์Šค๋“ค์„ ์ƒ์œ„ ๋‹จ๊ณ„ ํ๋กœ(์šฐ์„ ์ˆœ์œ„ ๋†’์ž„)
    ์™œ? => I/O๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ cpu๋ฅผ ์ž ์‹œ๋งŒ ์“ฐ๊ธฐ ๋•Œ๋ฌธ์—
  2. aging ๊ธฐ๋ฒ•
    ๋Œ€๊ธฐ์‹œ๊ฐ„์ด ์ง€์ •๋œ ์‹œ๊ฐ„์„ ์ดˆ๊ณผํ•œ ํ”„๋กœ์„ธ์Šค๋“ค์„ ์ƒ์œ„ ๋‹จ๊ณ„ ํ๋กœ

โœ๏ธparameters for MFQ scheduling

  • Queue์ˆ˜
  • Queue๋ณ„ ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜
  • ์šฐ์„ ์ˆœ์œ„ ์กฐ์ • ๊ธฐ์ค€
  • ์ตœ์ดˆ์˜ Queue ๋ฐฐ์ • ๋ฐฉ๋ฒ•
    ...

๐Ÿ“ฎ์ถœ์ฒ˜ : https://www.youtube.com/watch?v=hzXVQIlSSos&list=PLBrGAFAIyf5rby7QylRc6JxU5lzQ9c4tN

0๊ฐœ์˜ ๋Œ“๊ธ€