๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐“ก๐“ธ๐“ธ๐“ถ5: ๐’ฆ๐‘œ๐“‡๐‘’๐’ถ ๐’ฐ๐“ƒ๐’พ๐“‹/์šด์˜์ฒด์ œ Operating Systems (COSE341)

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

1. Basic Concepts

  • Multiprogramming : ์ปดํ“จํ„ฐ์˜ CPU์—์„œ ๋™์‹œ์— ์—ฌ๋Ÿฌ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•˜๋Š” ๊ธฐ์ˆ 
    • multiprogramming์˜ ๋ชฉ์ ์€ CPU utilization์˜ ๊ทน๋Œ€ํ™”์ž„

 

process๋Š” CPU execution ์ฃผ๊ธฐ์™€ I/O wain ์œผ๋กœ ๊ตฌ์„ฑ๋จ. ์ฆ‰, ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ผ์ • ์‹œ๊ฐ„ ๋™์•ˆ CPU์—์„œ ์‹คํ–‰๋œ ๋‹ค์Œ, ๊ณ„์† ์‹คํ–‰๋˜๊ธฐ ์ „์— I/O ์ž‘์—…์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆผ. 

 

CPU Burst distribution์€ 1) ์งง๊ณ  ๋งŽ์€ cpu burst ์™€ 2) ๊ธธ๊ณ  ์ ์€ cpu burst ๊ฐ€ ์žˆ๋Š”๋ฐ,

  • I/O Bound program์€ ์งง๊ณ  ๋งŽ์€ cpu burst๋ฅผ ๊ฐ€์ง€๋ฉฐ
  • CPU-Bound program์€ ๊ธธ๊ณ  ์ ์€ cpu burst๋ฅผ ๊ฐ€์ง

 

 distribution์—์„œ ์™ผ์ชฝ์€ burst duration์ด ์งง๊ณ  frequency๊ฐ€ ๋†’์€ I/O burst๊ฐ€ ํ•ด๋‹นํ•˜๋ฉฐ

์˜ค๋ฅธ์ชฝ์€ duration์ด ๊ธธ๊ณ  frequency๊ฐ€ ์ ์€ CPU burst๊ฐ€ ํ•ด๋‹นํ•œ๋‹ค

 


CPU Scheduler 

: CPU Scheduler๋Š” memory์—์„œ ready to execute ๋œ process ์ค‘ process๋ฅผ ์„ ํƒํ•˜๊ณ , ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค์— CPU๋ฅผ ํ• ๋‹นํ•œ๋‹ค

์ด๋Ÿฌํ•œ ์Šค์ผ€์ค„๋ง์„ ํ•˜๋Š” ์ƒํ™ฉ์€ ๋„ค ๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.

  1. ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰ ์ƒํƒœ์—์„œ ๋Œ€๊ธฐ ์ƒํƒœ๋กœ ์ „ํ™˜๋˜๋Š” ๊ฒฝ์šฐ
  2. ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰ ์ƒํƒœ์—์„œ ์ค€๋น„ ์ƒํƒœ๋กœ ์ „ํ™˜๋  ๋•Œ
  3. ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋Œ€๊ธฐ ์ƒํƒœ์—์„œ ์ค€๋น„ ์ƒํƒœ๋กœ ์ „ํ™˜๋  ๋•Œ
  4. ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ข…๋ฃŒ๋˜๋Š” ๊ฒฝ์šฐ

1, 4์˜ ๊ฒฝ์šฐ nonpreemption์ž„. ์ฆ‰ CPU๊ฐ€ ํ•˜๋‚˜๋ฅผ ์ด๋ฏธ ํ•˜๊ณ  ์žˆ์œผ๋ฉด ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค ํ• ๋‹น X ๊ธฐ๋‹ค๋ ค์•ผ ํ•จ

2, 3์˜ ๊ฒฝ์šฐ๋Š” ํ•˜๋˜ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘๋‹จํ•˜๊ณ  ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์Œ

Dispatcher

: CPU scheduler์— ์˜ํ•ด ์„ ํƒ ๋œ ํ”„๋กœ์„ธ์Šค๋ฅผ CPU์˜ core๋กœ ๋„˜๊ธฐ๋Š” ์—ญํ• ์„ ํ•จ.

 

์šฐ์„  ์ˆœ์œ„๋ฅผ ๋ถ€์—ฌํ•ด์•ผ ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ฒฐ์ •ํ–ˆ์œผ๋ฉด (scheduler) ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก CPU์— ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. ๋””์ŠคํŒจ์ฒ˜๋Š” ์‹œ์Šคํ…œ์ด CPU๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ํ™œ์šฉํ•˜๊ณ  ์ ์‹œ์— ์›Œํฌ๋กœ๋“œ ๋ณ€ํ™”์— ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„œ๋กœ ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค ์‚ฌ์ด๋ฅผ ๋น ๋ฅด๊ณ  ํšจ์œจ์ ์œผ๋กœ ์ „ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

1. Context switching

2. user mode switching

3. ๋‹ค์‹œ ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด jumping to the proper location

 

๋“ฑ์˜ ๋‹จ๊ณ„๋ฅผ ํฌํ•จํ•จ.

 

Dispatch latency : ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋ฉˆ์ถ”๊ณ  ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰(switching)์„ ํ•˜๋Š”๋ฐ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„. 


2. Scheduling Criteria

  • (MAX) CPU utilization : CPU๊ฐ€ Busyํ•œ ์ •๋„. ๋ฐ”์ ์ˆ˜๋ก ์ข‹์Œ
  • (MAX) Throughput : ์‹œ๊ฐ„ ๋‹น ๋๋‚ธ ํ”„๋กœ์„ธ์Šค์˜ ์ˆ˜. ๋งŽ์„ ์ˆ˜๋ก ์ข‹์Œ
  • (MIN) Turnaround time : ํ”„๋กœ์„ธ์Šค submission(๋„์ฐฉ ์‹œ์ )์œผ๋กœ๋ถ€ํ„ฐ ๋๋‚  ๋•Œ ๊นŒ์ง€์˜ Interval 
  • (MIN) Waiting time : wait queue์—์„œ ๊ธฐ๋‹ค๋ฆฐ ์‹œ๊ฐ„์˜ ์ด ํ•ฉ
  • (MIN) Response time : submission ์ดํ›„ ์ฒซ response๊ฐ€ ์ƒ์„ฑ๋  ๋•Œ ๊นŒ์ง€์˜ ์‹œ๊ฐ„. (์ „์ฒด ์ถœ๋ ฅX)

 
 
3. Scheduling Algorithms

1) First-Come, First-Served(FCFS) Scheduling

  • ready queue์— ๋จผ์ € ๋„์ฐฉํ•œ process๋ฅผ ๋จผ์ € cpu์— ํ• ๋‹นํ•จ (FIFO queue)
  • Convoy effect : ๋‹ค๋ฅธ ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•˜๋‚˜์˜ big process๊ฐ€ cpu์—์„œ ๋๋‚  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ค์•ผ ํ•˜๋Š” ๊ฒƒ

 
2) Shortest-Job-First (SJF) Scheduling

  • CPU Burst๊ฐ€ ๊ฐ€์žฅ ์ž‘์€ ํ”„๋กœ์„ธ์Šค์— CPU ํ• ๋‹น
  • ์‹คํ–‰์— ํ•„์š”ํ•œ ์‹œ๊ฐ„(cpu-burst-time)์ด ๊ฐ€์žฅ ์ ์€ ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ณ ๋ คํ•˜์—ฌ CPU๋ฅผ ํ• ๋‹น

 

  • Nonpreemptive : ์ˆ˜ํ–‰ ์ค‘ ๋” ์งง์€ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋„์ฐฉํ•ด๋„ ํ˜„์žฌ ์ง„ํ–‰๋˜๊ณ  ์žˆ๋Š” ํ”„๋กœ์„ธ์Šค๋Š” ๋๋‚ด๊ณ  ์ฒ˜๋ฆฌ
  • preemptive : ์ˆ˜ํ–‰ ์ค‘ ๋” ์งง์€๊ฒŒ ์˜ค๋ฉด ๋ฐ”๋กœ ํ˜„์žฌ ํ•˜๋˜ ํ”„๋กœ์„ธ์Šค ์ค‘๋‹จํ•˜๊ณ  ๋ฐ”๊ฟ”๋ฒ„๋ฆผ (=Shortest-Remaining-Time-First (SRTF) )



๋‹จ์ ) ๋‹ค์Œ CPU Request์˜ length๋ฅผ ์•Œ๊ธฐ ์–ด๋ ค์›€.

๋”ฐ๋ผ์„œ ์šฐ๋ฆฌ๋Š” process time์— limit์„ ์„ค์ •ํ•ด๋‘๊ณ , ๋ฌดํ•œํžˆ ๋Œ ๋•Œ ๋Š์–ด๋ฒ„๋ฆผ.

ํ˜น์€ ๊ทธ ๊ฐ’์„ ์˜ˆ์ƒํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅ

* next CPU burst ์˜ˆ์ƒํ•˜๊ธฐ (by exponential average)


tn : ์‹ค์ œ n๋ฒˆ์งธ ๋•Œ์˜ CPU Burst ๊ธธ์ด

τn+1 : ๋‹ค์Œ cpu burst ์˜ˆ์ƒ๊ฐ’

α : ์ตœ๊ทผ ๋ฐ์ดํ„ฐ๊ฐ€ ์–ผ๋งˆ๋‚˜ ์ค‘์š”ํ•œ์ง€ 

 - α = 0 : ์ตœ๊ทผ history no effect

 - α = 1 : ์˜ค์ง most recent cpu burst๋งŒ ์ค‘์š”

 - α = 1/2 : recent history์™€ past history๊ฐ€ equally weighted


3) Round Robin (RR)

  • FCFS๋ž‘ ์œ ์‚ฌํ•˜์ง€๋งŒ Preemption์ด ์ถ”๊ฐ€๋˜์–ด Process๊ฐ„ ์ „ํ™˜์ด ๊ฐ€๋Šฅํ•จ
    • time quantum(10~100milsec)์ด๋ผ๋Š” ๊ณ ์ •๋œ ์‹คํ–‰ ์‹œ๊ฐ„์ด ์ฃผ์–ด์ง. ๊ทธ ์‹œ๊ฐ„ ์ง€๋‚˜๋ฉด CPU๋Š” ์ด์ „ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰์„ ์™„๋ฃŒํ–ˆ๋Š”์ง€ ์—ฌ๋ถ€์— ๊ด€๊ณ„์—†์ด ready queue์— ์žˆ๋Š” ๋‹ค์Œ ํ”„๋กœ์„ธ์Šค ์‹คํ–‰. ํ•˜๋˜ ๊ฒƒ์€ ready queue ๋’ค๋กœ ๋‹ค์‹œ ๋ถ™์ž„
    • ๋งŒ์•ฝ ํ•œ quantum ์•ˆ์— ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋๋‚ฌ์œผ๋ฉด ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๋กœ ๋ฐ”๋กœ switching
  • ๋งŒ์•ฝ ready queue์— n ๊ฐœ์˜ process๊ฐ€ ์žˆ๊ณ , time quantum์ด q๋ผ๋ฉด ๊ฐ process๋Š” CPU ์‹œ๊ฐ„์˜ 1/ n์„ ์ตœ๋Œ€ q time units ๋งŒํผ๋งŒ ํ• ๋‹นํ•จ. ๋”ฐ๋ผ์„œ ๊ฐ process๋Š” (n-1)q ๋ณด๋‹ค ์˜ค๋ž˜ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๋Š”๋‹ค. (์–ด๋–ค ํ”„๋กœ์„ธ์Šค๊ฐ€ cpu๋ฅผ ์žฅ๊ธฐ ๋…์ ํ•˜์ง€ x)
  • Performance 
    • time quantum์ด ๋งค์šฐ ํฐ ๊ฒฝ์šฐ => FCFS์™€ ๋™์ผ
    • ์ž‘์€ ๊ฒฝ์šฐ : context swiches ๋„ˆ๋ฌด ์ž์ฃผ ์ผ์–ด๋‚จ

 
4) Priority Scheduling

  • ๊ฐ€์žฅ ๋†’์€ priority๋ฅผ ๊ฐ€์ง€๋Š” process๋ฅผ cpu์— ํ• ๋‹นํ•œ๋‹ค
    • equal-priority processes๋Š” FCFS order 
    • SJF ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ๊ฐ€์žฅ ๋‹จ์ˆœํ•œ priority algorithm (priority : inverse of next CPU burst, cpu burst ํฌ๋ฉด ์šฐ์„ ์ˆœ์œ„ ๋‚ฎ์Œ)
    • Priorities๋Š” internally/ externally ์ •์˜๋˜๋Š”๊ฒƒ ๋ชจ๋‘ ๊ฐ€๋Šฅ
      • Internally defined priorities: ์ธก์ • ๊ฐ€๋Šฅํ•œ quantity๋ฅผ ์ด์šฉํ•ด priority ๋ถ€์—ฌ
        • Time limits, memory requirements, open file ์ˆ˜, ํ‰๊ท  cpu Burst ๋Œ€๋น„ ํ‰๊ท  I/O Burst ๋น„์œจ 
      • External priorities : ์šด์˜์ฒด์ œ ์™ธ๋ถ€์˜ ๊ธฐ์ค€์— ๋”ฐ๋ผ ์„ค์ •
        • importance of the process, ์—…๋ฌด ํ›„์›ํ•˜๋Š” ๋ถ€์„œ, ์ •์น˜์  ์š”์ธ ๋“ฑ
  • Nonpreemptive : ํ•˜๋˜ ๊ฑฐ ๋๋ƒ„
  • preemptive
    • ์ž‘์—… ์ˆ˜ํ–‰ ๋„์ค‘ ๋” priority ๋†’์€ ์• ๊ฐ€ ๋„์ฐฉํ•˜๋ฉด ํ•˜๋˜๊ฑฐ ๋ฒ„๋ฆฌ๊ณ  ์ƒˆ๋กœ์šด๊ฑฐ ํ•จ

 

 

Problem - Starvation (indefinite blocking)

: low-priority process๋Š” ๋ฌดํ•œํžˆ ๊ธฐ๋‹ค๋ ค์•ผ ํ•จ

 

Solution - Aging 

: ์˜ค๋ž˜ ๊ธฐ๋‹ค๋ฆฐ process์˜ priority๋ฅผ ์ ์ง„์ ์œผ๋กœ ์ฆ๊ฐ€์‹œ

 

--> ์šฐ์„  ์ˆœ์œ„๊ฐ€ ๋†’์€ ํ”„๋กœ์„ธ์Šค์˜ ์‹คํ–‰ ์šฐ์„  ์ˆœ์œ„๋ฅผ ์ง€์ •ํ•จ์œผ๋กœ์จ ์šด์˜ ์ฒด์ œ๋Š” ์ค‘์š”ํ•œ ์ž‘์—…์ด ๋จผ์ € ์™„๋ฃŒ๋˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์‹œ์Šคํ…œ์€ ์‹œ๊ฐ„์— ๋ฏผ๊ฐํ•œ ์ž‘์—…์— ์‹ ์†ํ•˜๊ฒŒ ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‚ฎ์€ ์šฐ์„ ์ˆœ์œ„ ํ”„๋กœ์„ธ์Šค์— starvation ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ ์ „์ฒด ์‹œ์Šคํ…œ ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ๋ฌธ์ œ๋ฅผ ์™„ํ™”ํ•˜๊ธฐ ์œ„ํ•ด ์ผ๋ถ€ ์šฐ์„ ์ˆœ์œ„ ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์—์ด์ง•์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ค€๋น„ ๋Œ€๊ธฐ์—ด์—์„œ ์˜ค๋žซ๋™์•ˆ ๋Œ€๊ธฐํ•œ ๊ฒฝ์šฐ ์‹œ๊ฐ„์ด ์ง€๋‚จ์— ๋”ฐ๋ผ ํ”„๋กœ์„ธ์Šค์˜ ์šฐ์„ ์ˆœ์œ„๋ฅผ ๋†’์ด๋Š” ๊ฒƒ๊ณผ ๊ด€๋ จ๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์šฐ์„  ์ˆœ์œ„ ๊ฐ’์ด ๋” ๋‚ฎ์€ ๊ฒฝ์šฐ์—๋„ ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๊ฐ€ ๊ฒฐ๊ตญ ์‹คํ–‰ ๊ธฐํšŒ๋ฅผ ์–ป๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

* ์šฐ์„  ์ˆœ์œ„๊ฐ€ ๊ฐ™์€ process ๊ฐ„์—๋Š” Round-robin ์ ์šฉํ•  ์ˆ˜ ์žˆ์Œ


5) Multilevel Queue Scheduling

  • Process type์— ๋”ฐ๋ผ queues๋ฅผ ๊ตฌ๋ถ„ํ•ด์„œ ๋”ฐ๋กœ ๋‘๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜
    • Foreground(interactive), background(batch)
    • priority ๋งˆ๋‹ค ๊ฐ๊ฐ ํ ๋งŒ๋“ค์–ด์„œ ๊ด€๋ฆฌํ•  ์ˆ˜๋„ ์žˆ์Œ (์–ด๋–ค ํ”„๋กœ์„ธ์Šค๊ฐ€ highst-priority์ธ์ง€ ์•Œ๋ ค๋ฉด O(n)) search๊ฐ€ ํ•„์š”ํ•จ)

  • ๊ฐ ํ๋Š” ๊ฐ์ž์˜ ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ
    • ๊ฐ ๋Œ€๊ธฐ์—ด์˜ ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ํ•ด๋‹น ๋Œ€๊ธฐ์—ด์— ํ• ๋‹น๋œ ์šฐ์„  ์ˆœ์œ„ ์ˆ˜์ค€์— ๋”ฐ๋ผ ๊ฒฐ์ •
    • ์˜ˆ๋ฅผ ๋“ค์–ด ์šฐ์„ ์ˆœ์œ„๊ฐ€ ๋†’์€ ํ๋Š” ๋ผ์šด๋“œ ๋กœ๋นˆ๊ณผ ๊ฐ™์€ preemption์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜๊ณ  ๋‚ฎ์€ ์šฐ์„ ์ˆœ์œ„ ํ๋Š” FCFS์™€ ๊ฐ™์€ non-preemption ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉ
  • ํ ์‚ฌ์ด์˜ ์Šค์ผ€์ค„๋ง๋„ ํ•ด์•ผ ํ•จ
    • ํ ๊ฐ„ ์šฐ์„ ์ˆœ์œ„๋„ ์žˆ์Œ. ๋”ฐ๋ผ์„œ starvation ์œ„ํ—˜๋„ ์žˆ์Œ
    • Time slice: ๊ฐ ํ๋Š” CPU Time์˜ ์ผ๋ถ€๋ฅผ ํ• ๋‹น๋ฐ›์•„ ๊ทธ ์•ˆ์—์„œ ์Šค์ผ€์ค„๋ง
      • Foreground Queue - 80% of the CPU time 
      • Background Queue - 20% of CPU time

  • [Multilevel Feedback Queue scheduling] 
    • ํ ๊ฐ„ ํ”„๋กœ์„ธ์Šค ์ด๋™์ด ํ—ˆ์šฉ๋œ๋‹ค๋ฉด (=aging) starvation์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Œ
      • ๋งŒ์•ฝ ํ•œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์€ CPU ํƒ€์ž„์„ ์žก์•„๋จน๋Š”๋‹ค๋ฉด  lower-priority๋กœ ์ด๋™
      • ํ•œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋„ˆ๋ฌด ์˜ค๋ž˜ ๊ธฐ๋‹ค๋ ธ์œผ๋ฉด higher-priority queue๋กœ ์ด๋™
         
    • MFQS๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ parameter๋กœ ์ •์˜๋จ
      • โœ“ The number of queues
      • โœ“ The scheduling algorithm for each queue
      • โœ“ The method used to determine when to upgrade a process
      • โœ“ The method used to determine when to demote a process
      • โœ“ The method used to determine which queue a process will enter when that process needs service

 
4. Multie-Processor Scheduling

์—ฌ๋Ÿฌ CPU ๋˜๋Š” ํ”„๋กœ์„ธ์„œ๋ฅผ ๋™์‹œ์— ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜. ํ”„๋กœ์„ธ์Šค๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ์—ฌ๋Ÿฌ ๊ฐœ์˜ CPU๊ฐ€ ์žˆ์–ด ๊ฐ CPU์— ํ”„๋กœ์„ธ์Šค๋ฅผ ํ• ๋‹นํ•˜๊ณ  CPU๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ๋ณ‘๋ ฌ์ ์œผ๋กœ ์‹คํ–‰

์šด์˜ ์ฒด์ œ๋Š” ๋ชจ๋“  CPU์— ๊ฑธ์ณ workload balance๋ฅผ ์œ ์ง€ํ•˜๊ณ  ๊ฐ CPU๊ฐ€ ์‹คํ–‰ํ•  ํ”„๋กœ์„ธ์Šค ์ˆ˜๊ฐ€ ๊ฑฐ์˜ ๋™์ผํ•˜๋„๋ก ํ•ด์•ผ ํ•จ

 

  • Asymmetric multiprocessing
    • ์‹œ์Šคํ…œ ๋ฆฌ์†Œ์Šค๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ๋ณด์กฐ ํ”„๋กœ์„ธ์„œ๋ฅผ ์ œ์–ดํ•˜๋Š” โ€‹โ€‹ํ•˜๋‚˜์˜ ๊ธฐ๋ณธ ํ”„๋กœ์„ธ์„œ๊ฐ€ ์žˆ์Œ. ์ด single processor์— ์˜ํ•ด handled (master server)
    • ํ•œ ํ”„๋กœ์„ธ์„œ๊ฐ€ system data structure์— ์ ‘๊ทผํ•˜๋ฏ€๋กœ data sharing ํ•„์š” X
  • Symmetric multiprocessing
    • ๋ชจ๋“  CPU๊ฐ€ ๋™๋“ฑํ•˜๊ฒŒ ์ทจ๊ธ‰๋˜๋ฉฐ ๋ชจ๋“  CPU๋Š” ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Œ
    • ๊ฐ ํ”„๋กœ์„ธ์„œ๊ฐ€ self-scheduling
    • common ready queue
      • core๊ฐ€ ready queue๋ฅผ ๊ณต์œ ํ•ด ์ž‘์—…๋“ค์ด ๊ณ ๋ฅด๊ฒŒ ๋ถ„๋ฐฐ๋จ
      • BUT shared ready queue ์—์„œ race condition์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ
        • race condition์ด๋ž€ ๋‘ ๊ฐœ ์ด์ƒ์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๊ณตํ†ต ์ž์›์„ ๋™์‹œ์— ์ฝ๊ฑฐ๋‚˜ ์“ฐ๋Š” ๋™์ž‘์„ ํ•  ๋•Œ, ์ ‘๊ทผ์ด ์–ด๋–ค ์ˆœ์„œ์— ๋”ฐ๋ผ ์ด๋ฃจ์–ด์กŒ๋Š”์ง€์— ๋”ฐ๋ผ ๊ทธ ์‹คํ–‰ ๊ฒฐ๊ณผ๊ฐ€ ๊ฐ™์ง€ ์•Š๊ณ  ๋‹ฌ๋ผ์ง€๋Š” ์ƒํ™ฉ์„ ๋งํ•œ๋‹ค. Race ๋Š” ๋‘ ๊ฐœ์˜ ์Šค๋ ˆ๋“œ๊ฐ€ ํ•˜๋‚˜์˜ ์ž์›์„ ๋†“๊ณ  ์„œ๋กœ ๊ฒฝ์Ÿํ•˜๋Š” ์ƒํ™ฉ์„ ๋งํ•œ๋‹ค.
      • ์ด๋Ÿฐ ๋ฌธ์ œ๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด locking ์‚ฌ์šฉํ•จ
    • own private queue
      • ๊ฐ core๋ณ„๋กœ ready Queue ๊ฐ€ ์กด์žฌํ•จ. ์ž‘์—…์ด ํ•˜๋‚˜๋กœ ๋ชฐ๋ฆด ์ˆ˜ ์žˆ์Œ
        • ๋‹ค์–‘ํ•œ size์˜ workloads
        • ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค ๊ฐ„์˜ workload๋ฅผ equaliizingํ•˜๋Š” balancing algorithm์ด ํ•„์š”

Multicore processor : ๋‹จ์ผ ๋ฌผ๋ฆฌ์  chip์— ์—ฌ๋Ÿฌ๊ฐœ์˜ computing cores ๊ฐ€ ํฌํ•จ๋œ cpu

 --> CPU๊ฐ€ ๋ฌผ๋ฆฌ์  chip ์—ฌ๋Ÿฌ ๊ฐœ ๊ฐ–๋Š” ๊ฒƒ๋ณด๋‹ค ๋น ๋ฅด๊ณ  ๋” ์ ์€ ์ „์›์„ ์†Œ๋น„

 

Memory stall : ํ”„๋กœ์„ธ์„œ๊ฐ€ memory์— accessํ•  ๋•Œ, ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„ ๋•Œ๊นŒ์ง€ ์ƒ๋‹นํžˆ ์˜ค๋žœ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆผ

--> ํ”„๋กœ์„ธ์„œ๋Š” ๋ฐ์ดํ„ฐ available์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๋ฐ์— ์ตœ๋Œ€ 50% ์‹œ๊ฐ„์„ ์“ธ ์ˆ˜ ์žˆ์Œ

 

Multithreaded processing core : 2๊ฐœ ์ด์ƒ์˜ hw threads๊ฐ€ ๊ฐ core์— ํ• ๋‹น๋จ

* CMT (Chip Multithreading)

- ๋™์ผํ•œ ๋ฌผ๋ฆฌ์  ์นฉ์— ์—ฌ๋Ÿฌ computing core์„ ๋ฐฐ์น˜ํ•˜๊ณ , ๊ฐ core์—๋Š” hw thread๊ฐ€ ํฌํ•จ๋จ. ๊ฐ hw thread๋Š” instruction pointer๋‚˜ register set์™€ ๊ฐ™์ด architectural state๋ฅผ ์œ ์ง€ํ•˜๋ฉฐ, software thread๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” logical CPU์˜ ํ˜•ํƒœ๋กœ ๋‚˜ํƒ€๋‚จ. ์ด๋ฅผ ํ†ตํ•ด ๋‹จ์ผ ํ”„๋กœ์„ธ์„œ ์นฉ์—์„œ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Œ.

 

์ด ์˜ˆ์—์„œ๋Š” ํ”„๋กœ์„ธ์„œ์— 4๊ฐœ์˜ ์ปดํ“จํŒ… ์ฝ”์–ด๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฉฐ ๊ฐ ์ฝ”์–ด์—๋Š” 2๊ฐœ์˜ ํ•˜๋“œ์›จ์–ด ์Šค๋ ˆ๋“œ๊ฐ€ ์žˆ์Œ.

๋”ฐ๋ผ์„œ ์†Œํ”„ํŠธ์›จ์–ด ์Šค๋ ˆ๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ด 8๊ฐœ์˜ ๋…ผ๋ฆฌ์  CPU๊ฐ€ ์ƒ์„ฑ๋จ.

 

 

Multithread์˜ ๋‘ ๊ฐ€์ง€ ๋ฐฉ์‹:

 

1. Coarse-grained multithreading

: ๋‹ค์Œ ์Šค๋ ˆ๋“œ๋กœ ์ „ํ™˜ํ•˜๊ธฐ ์ „์— ๋‹จ์ผ ์‹คํ–‰ ์Šค๋ ˆ๋“œ์— ์ „์ฒด ํ”„๋กœ์„ธ์„œ ์ฃผ๊ธฐ๋ฅผ ํ• ๋‹นํ•˜๋Š” ๊ฒƒ. ์ด๋Š” ๊ฐ ์Šค๋ ˆ๋“œ๊ฐ€ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์˜ ์‹คํ–‰ ์ „ ํŠน์ • ์‹œ๊ฐ„ ๋™์•ˆ ํ”„๋กœ์„ธ์„œ์— ๋…์ ์ ์œผ๋กœ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•จ.  stalling๋™์•ˆ clock cycle์„ ๋‚ญ๋น„ํ•จ

2. Fine-grained(or interleaved) multithreading

: ๋‹จ์ผ ํ”„๋กœ์„ธ์„œ ์ฃผ๊ธฐ ๋‚ด์—์„œ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์˜ ์‹คํ–‰์„ ์ธํ„ฐ๋ฆฌ๋น™ .๋นˆํผ์—†์ด stalling ์ตœ์†Œํ™” ํ•จ 

 

 

Load Balancing : SMP system (Symmetric Multiprocessing) ์—์„œ processors ๊ฐ„ workload๋ฅผ ๊ณ ๋ฅด๊ฒŒ ๋ถ„๋ฐฐํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ (own private ready queue ์‚ฌ์šฉ) (ํŠน์ • cpu์— ์ž‘์—… ๋ชฐ๋ฆด ๋•Œ how to ๋ถ„๋ฐฐ)

1. Push migration : ๋ฐ”์œ ๊ณณ์—์„œ ๋œ ๋ฐ”์œ ๊ณณ์œผ๋กœ ์˜ฎ๊ธฐ๊ธฐ

2. Pull migration 

 

migrateํ•  ๋•Œ ์ฒซ ๋ฒˆ์งธ ํ”„๋กœ์„ธ์„œ์˜ cache memory๊ฐ€ invalidated ๋˜๊ณ  ๋‘ ๋ฒˆ์งธ processor์˜ cache๋ฅผ ๋‹ค์‹œ ์ฑ„์›Œ์•ผ ํ•จ. ๋”ฐ๋ผ์„œ ์ด๋Ÿฌํ•œ ๊ณผ์ •์ด high cost์ž„.

 

Processor affinity - ์˜ฎ๊ธฐ๋Š” ๊ฑฐ ์‹ซ์–ดํ•จ (overhead). ๋จธ๋ฌด๋ฅด๋ ค๋Š” ์†์„ฑ. ์“ฐ๋ ˆ๋“œ๋ฅผ ์ตœ๋Œ€ํ•œ ๊ฐ™์€ ํ”„๋กœ์„ธ์„œ๋กœ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ๋…ธ๋ ฅ. ํ”„๋กœ์„ธ์„œ ๊ฐ„ ์ „ํ™˜๊ณผ ๊ด€๋ จ๋œ ์˜ค๋ฒ„ํ—ค๋“œ๋ฅผ ์ค„์ž„์œผ๋กœ์จ ๋ณ‘๋ ฌ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ๋ฐ ์‚ฌ์šฉ๋จ.

 1) Soft affinity :  preferred processor ์—์„œ ์‹คํ–‰ํ•˜๋ ค๊ณ  ํ•˜์ง€๋งŒ ๋ฌด์กฐ๊ฑด์€ ์•„๋‹˜ ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์„œ์— ํ• ํ•  ์ˆ˜ ์žˆ์Œ

 2) Hard affinity : ์ง€์ •๋œ ํ”„๋กœ์„ธ์„œ์—์„œ๋งŒ ์Šค๋ ˆ๋“œ ๋˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ scheduleํ•˜๊ณ  ๊ทธ์™ธ์—์„œ๋Š” ์ ˆ๋Œ€ ์•ˆ ํ•จ

 

load balancing์€ ์ด๋Ÿฌํ•œ processor affinity์˜ ์žฅ์ ์„ ์—†์• ๋ฒ„๋ฆด ์ˆ˜๋„ ์žˆ์Œ

 

๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ์œผ๋กœ ์ธํ•ด ํŠน์ • ํ”„๋กœ์„ธ์„œ์— ์ด๋ฏธ ๋ฐ”์ธ๋”ฉ๋œ ์Šค๋ ˆ๋“œ๋‚˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์„œ๋กœ ์ด๋™๋˜๊ธฐ๋„ ํ•จ

 

*Non-uniform memory access (NUMA)

: ๋ฉ”๋ชจ๋ฆฌ ์•ก์„ธ์Šค ์‹œ๊ฐ„์ด ํ”„๋กœ์„ธ์„œ์™€ ๊ด€๋ จ๋œ ๋ฉ”๋ชจ๋ฆฌ ์œ„์น˜์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง€๋Š” ๋‹ค์ค‘ ์ฒ˜๋ฆฌ์— ์‚ฌ์šฉ๋˜๋Š” ์ปดํ“จํ„ฐ ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„

NUMA๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ํ”„๋กœ์„ธ์„œ๊ฐ€ ๋‘˜ ์ด์ƒ์ธ ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉ๋˜๋ฉฐ ๊ฐ ํ”„๋กœ์„ธ์„œ๋Š” ์ž์ฒด ๋กœ์ปฌ ๋ฉ”๋ชจ๋ฆฌ์— ์•ก์„ธ์Šคํ•˜๊ณ  ๊ณต์œ  ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์—๋„ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

NUMA ์‹œ์Šคํ…œ์€ ์ฒ˜๋ฆฌ๋ฅผ ๋กœ์ปฌ ๋ฉ”๋ชจ๋ฆฌ์— ๊ฐ€๊น๊ฒŒ ์œ ์ง€ํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ ์•ก์„ธ์Šค ๋Œ€๊ธฐ ์‹œ๊ฐ„์„ ์ตœ์†Œํ™”ํ•˜๋„๋ก ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์•ก์„ธ์Šคํ•ด์•ผ ํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ์— ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ํ”„๋กœ์„ธ์„œ์— ํ”„๋กœ์„ธ์Šค๋ฅผ ํ• ๋‹นํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ํ”„๋กœ์„ธ์„œ์™€ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์ด์˜ ๊ฑฐ๋ฆฌ๋ฅผ ์ตœ์†Œํ™”ํ•จ์œผ๋กœ์จ NUMA ์‹œ์Šคํ…œ์€ ๊ธฐ์กด SMP(๋Œ€์นญ ๋‹ค์ค‘ ์ฒ˜๋ฆฌ) ์‹œ์Šคํ…œ๋ณด๋‹ค ๋” ๋‚˜์€ ์„ฑ๋Šฅ๊ณผ ํ™•์žฅ์„ฑ์„ ๋‹ฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


5. Real-Time CPU Scheduling

 

: for ์ฆ‰๊ฐ์ ์ธ ์ฒ˜๋ฆฌ. ๋ผ์šด๋“œ ๋กœ๋นˆ ๋˜๋Š” SJF ๊ณผ ๊ฐ™์€ ํ‘œ์ค€ CPU ์Šค์ผ€์ค„๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜๊ณผ ๋‹ค๋ฅธ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹ค์‹œ๊ฐ„ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ •์‹œ์— ์‹คํ–‰๋˜๋„๋ก ํ•จ

 

  1) Soft-real-time systems

  : ํ”„๋กœ์„ธ์Šค์— ์šฐ์„  ์ˆœ์œ„๊ฐ€ ๋ถ€์—ฌ๋˜์ง€๋งŒ ๋ฐ˜๋“œ์‹œ ์ค€์ˆ˜ํ•ด์•ผ ํ•˜๋Š” ์—„๊ฒฉํ•œ ๊ธฐํ•œ์€ ์—†์Œ

 

  2) Hard real-time systems 

  : ๋ฌด์กฐ๊ฑด task๊ฐ€ dealine์— ๋งž์ถฐ์„œ ์ฒ˜๋ฆฌ๋˜์–ด์•ผ ํ•จ

 

event latency : event๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ๊ทธ๊ฒƒ์ด ์„œ๋น„์Šค ๋˜๊ธฐ๊นŒ์ง€์˜ time

  - Interrupt latency : inturrupt๊ฐ€ ๋„์ฐฉํ•˜๊ณ  ํ•ด๋‹น ์ธํ„ฐ๋ŸฝํŠธ ์ฒ˜๋ฆฌ๊ฐ€ ์‹œ์ž‘๋˜๊ธฐ ๊นŒ์ง€์˜ ์‹œ๊ฐ„ (์ง€์—ฐ)

  - Dispatch latency : dispatcher๊ฐ€ ํ•œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ณ  ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„

ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰๋  ์ค€๋น„๊ฐ€ ๋˜๋ฉด ์šด์˜ ์ฒด์ œ๋Š” ์ ์ ˆํ•œ ํ”„๋กœ์„ธ์„œ๋ฅผ ์„ ํƒํ•˜๊ณ  ์ปจํ…์ŠคํŠธ๋ฅผ ํ˜„์žฌ ํ”„๋กœ์„ธ์Šค์—์„œ ์ƒˆ ํ”„๋กœ์„ธ์Šค๋กœ ์ „ํ™˜ํ•ด์•ผ ํ•จ. 

  • ์ด๋ฏธ kernel์—์„œ ์‹คํ–‰์ค‘์ธ process์— ๋Œ€ํ•œ preemption
  • low-priority process๋ฅผ ํ•ด์ œํ•˜๊ณ  high-priority process์—๊ฒŒ resource ์ฃผ๊ธฐ

๊ณผ์ •์—์„œ latency ๋ฐœ์ƒ

 

 

 
1) Priority-based scheduling

 : real-time operating system์˜ ์Šค์ผ€์ค„๋Ÿฌ๋Š” priority-based algorithm with preemption์„ ์ง€์›ํ•ด์•ผ ํ•จ 

(๋ฐ๋“œ๋ผ์ธ ์–ผ๋งˆ ์•ˆ๋‚จ์Œ == priority ๋†’์Œ)

( soft real-time ๋งŒ ๋ณด์žฅํ•จ)

 

periodic : CPU์˜ constant intervals

ํ•„์š”ํ•œ ์ฒ˜๋ฆฌ ์‹œ๊ฐ„ t, ๋ฐ๋“œ๋ผ์ธ d, period p 

 

0<=t<=d<=p

 


2) Rate-Monotonic Scheduling

๊ธฐ๊ฐ„์ด ์งง๊ฑฐ๋‚˜ ๋นˆ๋„๊ฐ€ ๋†’์€ ํ”„๋กœ์„ธ์Šค์— ๋” ๋†’์€ ์šฐ์„  ์ˆœ์œ„๊ฐ€ ์ง€์ •

: static priority policy with preemption

  • ๊ฐ period task์—๋Š” ์ฃผ๊ธฐ์— ๋”ฐ๋ผ ๊ฑฐ๊พธ๋กœ priority๊ฐ€ ํ• ๋‹น๋จ
    • period๊ฐ€ ์งง์„ ์ˆ˜๋ก priority๊ฐ€ ๋†’์•„์ง
  • ๋งŒ์•ฝ ํ”„๋กœ์„ธ์Šค period P1, P2๊ฐ€ ๊ฐ๊ฐ 50, 100์ผ ๋•Œ, processing time t1 = 20 (P1) t2 = 35(P2) ๋ผ๊ณ  ํ•˜๋ฉด
    • ํ”„๋กœ์„ธ์Šค์˜ CPU utilization ratedms t/p์ž„
      • P1 : 20/50 = 0.4
      • P2 : 35/100 = 0.35
  • ๊ทธ๋Ÿฌ๋ฏ€๋กœ ์ด๋Ÿฌํ•œ Task๋ฅผ deadline์€ ๋งž์ถ”๋ฉด์„œ CPU์˜ available cycles์„ ๋‚จ๊ฒจ๋‘๋Š” ๋ฐฉ์‹์œผ๋กœ ์Šค์ผ€์ค„

 

์˜ˆ๋ฅผ ๋“ค์–ด P2๋ณด๋‹ค P1์ด ๋” period ๊ฐ€ ์งง๋‹ค๋ฉด, ๋” ๋†’์€ ์šฐ์„  ์ˆœ์œ„๋ฅผ ๊ฐ–๋Š”๋‹ค.

๋งŒ์•ฝ P1์ด๋‚˜ P2์˜ Period๊ฐ€ ํ•œ ๋ฒˆ ๋๋‚˜๋ฉด ๋ฌด์กฐ๊ฑด switch

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด miss ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ƒ๊น€

 

๋”ฐ๋ผ์„œ CPU resource๋ฅผ ํ•ญ์ƒ maximizeํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅ

worst case (N processes) : N(2^(1/N) - 1)

Process๊ฐ€ ํ•˜๋‚˜์žˆ์œผ๋ฉด CPU utilization 100%, ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋งŽ์•„์งˆ ์ˆ˜๋ก 69%๊นŒ์ง€ ๋–จ์–ด์ง

 

 

P2 ๋จผ์ € ํ•˜๋ฉด P1์ด miss๋‚˜์ง€๋งŒ, ๋” ์งง์€ p1 ๋จผ์ € ํ•˜๋ฉด ๊ดœ์ฐฎ์Œ

but ์ด๊ฒฝ์šฐ์—๋Š” p2๊ฐ€ miss๊ฐ€ ๋‚จ

 


3) Earliest Deadline First Scheduling (EDF)


 : deadline์ด ๋น ๋ฅธ ๊ฒƒ์ด ๋†’์€ priority๋ฅผ ๊ฐ–๋Š”๋‹ค! ๋ˆˆ ์•ž์— ๋ณด์ด๋Š” deadline ๋จผ์ € ์ฒ˜๋ฆฌ. 

์ž‘์—… ๋๋‚˜๋ฉด switch. period ์ง€๋‚ฌ์„ ๋•Œ ๋ฐ๋“œ๋ผ์ธ ๊ฒ€์‚ฌ ๋‹ค์‹œ ํ•ด์„œ ๋ณ€๋™ ์žˆ์œผ๋ฉด ๋‹ค์‹œ switch

RLT ์Šค์ผ€์ค„๋ง ์ค‘ ํ•ต์‹ฌ. ๋ฌด์กฐ๊ฑด ์ž˜ ๋จ!
 
6. Operating System Examples
1) Linux
 
2) Windows
 
3) Solaris
 
7. Algorithm Evaluation
 

1) ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์„ ํƒํ•  ๋•Œ์˜ ๊ธฐ์ค€ ์„ ์ •

  • Maximizing CPU utilization
  • Maximizing throughput

2) deterministic modeling

๋ฏธ๋ฆฌ workload์™€ performance ์˜ˆ์ธก