Scheduler

Process Scheduling์„ ์œ„ํ•œ Queue์˜ ์ข…๋ฅ˜ (3๊ฐ€์ง€)

  • Job Queue

    • ํ˜„์žฌ ์‹œ์Šคํ…œ ๋‚ด์— ์žˆ๋Š” ๋ชจ๋“  process์˜ ์ง‘ํ•ฉ

  • Ready Queue

    • ํ˜„์žฌ ๋ฉ”๋ชจ๋ฆฌ ๋‚ด์— ์žˆ์œผ๋ฉด์„œ CPU๋ฅผ ์žก์•„์„œ ์‹คํ–‰๋˜๊ธฐ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” process์˜ ์ง‘ํ•ฉ

  • Device Queue

    • Device I/O ์ž‘์—…์„ ๋Œ€๊ธฐํ•˜๊ณ  ์žˆ๋Š” process์˜ ์ง‘ํ•ฉ

Scheduler์˜ ์ข…๋ฅ˜

์žฅ๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ (Job scheduler)

๋ฉ”๋ชจ๋ฆฌ๋Š” ํ•œ์ •๋˜์–ด ์žˆ๋Š”๋ฐ ๋งŽ์€ ํ”„๋กœ์„ธ์Šค๋“ค์ด ํ•œ๊บผ๋ฒˆ์— ๋ฉ”๋ชจ๋ฆฌ์— ์˜ฌ๋ผ์˜ฌ ๊ฒฝ์šฐ, ๋Œ€์šฉ๋Ÿ‰ ๋ฉ”๋ชจ๋ฆฌ (์ผ๋ฐ˜์ ์œผ๋กœ ๋””์Šคํฌ)์— ์ž„์‹œ๋กœ ์ €์žฅ๋œ๋‹ค

โ†’ ์ด pool์— ์ €์žฅ๋˜์–ด ์žˆ๋Š” process ์ค‘, ์–ด๋–ค process์— ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹นํ•˜์—ฌ ready queue๋กœ ๋ณด๋‚ผ์ง€ ๊ฒฐ์ • ํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค

  • ๋ฉ”๋ชจ๋ฆฌ ์™€ ๋””์Šคํฌ ์‚ฌ์ด์˜ ์Šค์ผ€์ค„๋ง์„ ๋‹ด๋‹นํ•œ๋‹ค

  • process์— memory๋ฅผ ๋น„๋กฏํ•œ ๊ฐ์ข… ๋ฆฌ์†Œ์Šค๋ฅผ ํ• ๋‹นํ•œ๋‹ค (admit)

  • ์‹คํ–‰์ค‘์ธ ํ”„๋กœ์„ธ์Šค์˜ ์ˆ˜๋ฅผ ์ œ์–ดํ•œ๋‹ค

  • ํ”„๋กœ์„ธ์Šค์˜ ์ƒํƒœ๋ฅผ new โ†’ ready (in memory)๋กœ ๋ฐ”๊พผ๋‹ค

  • ์ฐธ๊ณ )

    • memory์— ํ”„๋กœ๊ทธ๋žจ์ด ๋„ˆ๋ฌด ๋งŽ์ด ์˜ฌ๋ผ๊ฐ€๋„, ๋„ˆ๋ฌด ์ ๊ฒŒ ์˜ฌ๋ผ๊ฐ€๋„ ์„ฑ๋Šฅ์ด ์ข‹์ง€ ์•Š์€ ๊ฒƒ์ด๋‹ค.

    • ์ฐธ๊ณ ๋กœ time sharing system์—์„œ๋Š” ์žฅ๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ๊ฐ€ ์—†๋‹ค

      • ๊ทธ๋ƒฅ ๊ณง๋ฐ”๋กœ memory์— ์˜ฌ๋ผ๊ฐ€ ready ์ƒํƒœ๊ฐ€ ๋œ๋‹ค

๋‹จ๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ (CPU scheduler)

  • CPU์™€ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์ด์˜ ์Šค์ผ€์ค„๋ง์„ ๋‹ด๋‹น

  • Ready Queue ์— ์กด์žฌํ•˜๋Š” process ์ค‘์— ์–ด๋–ค process๋ฅผ running ์‹œํ‚ฌ์ง€ ๊ฒฐ์ •

  • Process์— CPU๋ฅผ ํ• ๋‹น

    • scheduler dispatch

  • ํ”„๋กœ์„ธ์Šค์˜ ์ƒํƒœ๋ฅผ ready โ†’ running โ†’ waiting โ†’ ready๋กœ ๋ณ€๊ฒฝ์‹œํ‚จ๋‹ค

์ค‘๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ

Swapping!

  • ์—ฌ์œ  ๊ณต๊ฐ„ ๋งˆ๋ จ์„ ์œ„ํ•ด process๋ฅผ ํ†ต์งธ๋กœ ๋ฉ”๋ชจ๋ฆฌ โ†’ ๋””์Šคํฌ๋กœ ์ซ“์•„๋ƒ„ (swapping)

  • process ์—๊ฒŒ์„œ memory๋ฅผ deallocation

    • process์—์„œ memory ํ• ๋‹น์„ ํ•ด์ œํ•œ๋‹ค!!

  • ํ˜„ ์‹œ์Šคํ…œ์—์„œ ๋ฉ”๋ชจ๋ฆฌ์— ๋„ˆ๋ฌด ๋งŽ์€ ํ”„๋กœ๊ทธ๋žจ์ด ๋™์‹œ์— ์˜ฌ๋ผ๊ฐ€๋Š” ๊ฒƒ์„ ์กฐ์ ˆํ•˜๋Š” ์Šค์ผ€์ค„๋Ÿฌ

  • ํ”„๋กœ์„ธ์Šค์˜ ์ƒํƒœ๋ฅผ ready โ†’ suspended๋กœ ๋ฐ”๊พผ๋‹ค

    • Process state - suspended ๋ž€?

      • ์™ธ๋ถ€์ ์ธ ์ด์œ ๋กœ process์˜ ์ˆ˜ํ–‰์ด ์ •์ง€๋œ ์ƒํƒœ๋กœ, memory์—์„œ ๋‚ด๋ ค๊ฐ„ ์ƒํƒœ๋ฅผ ์˜๋ฏธํ•œ๋‹ค

      • process ์ „๋ถ€ ๋””์Šคํฌ๋กœ swap out ๋œ๋‹ค

      • Blocked ์ƒํƒœ๋Š” ๋‹ค๋ฅธ I/O ์ž‘์—…์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์—, ์Šค์Šค๋กœ ready๋กœ ๋Œ์•„๊ฐˆ ์ˆ˜ ์žˆ์ง€๋งŒ,

        • ์ด ์ƒํƒœ๋Š” ์™ธ๋ถ€์ ์ธ ์ด์œ ๋กœ suspending ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์Šค์Šค๋กœ ๋Œ์•„๊ฐˆ ์ˆ˜ ์—†๋‹ค

Last updated