[210625 TIL - (2)] OS

Choi RimΒ·2021λ…„ 6μ›” 25일
0

Way to developer

λͺ©λ‘ 보기
7/21
post-thumbnail

FCFS, RR

κΈ°λ³Έ μŠ€μΌ€μ€„λ§ μ•Œκ³ λ¦¬μ¦˜λ“€

Basic Scheduling algorithms

  • FCFS (First-Come-First-Service)
  • RR (Round-Robin)
  • SPN (Shortest-Process-Next)
  • SRTN (Shortest Remaining Time Next)
  • HRRN (High-Response-Ratio-Next)
  • MLQ (Multi-level Queue)
  • MFQ (Multi-level Feedback Queue

FCFS (First-Come-First-Service)

μ„ μ°©μˆœ μ•Œκ³ λ¦¬μ¦˜

  • Non-preemptive scheduling
  • μŠ€μΌ€μ€„λ§ κΈ°μ€€ (Criteria)
    • 도착 μ‹œκ°„ (ready queue κΈ°μ€€)
    • λ¨Όμ € λ„μ°©ν•œ ν”„λ‘œμ„ΈμŠ€λ₯Ό λ¨Όμ € 처리
  • μžμ›μ„ 효율적으둜 μ‚¬μš© κ°€λŠ₯
    • High resource utilization / why?
  • Batch system에 적합, interactive system에 뢀적합
  • 단점
    • Convoy effect
      • ν•˜λ‚˜μ˜ μˆ˜ν–‰μ‹œκ°„μ΄ κΈ΄ ν”„λ‘œμ„ΈμŠ€μ— μ˜ν•΄ λ‹€λ₯Έ ν”„λ‘œμ„ΈμŠ€λ“€μ΄ κΈ΄ λŒ€κΈ°μ‹œκ°„μ„ κ°–κ²Œ λ˜λŠ” ν˜„μƒ (λŒ€κΈ°μ‹œκ°„ >> μ‹€ν–‰μ‹œκ°„)
    • κΈ΄ 평균 μ‘λ‹΅μ‹œκ°„ (response time)

RR (Round-Robin)

  • Preemptive scheduling
  • μŠ€μΌ€μ€„λ§ κΈ°μ€€ (Criteria)
    • 도착 μ‹œκ°„ (ready queue κΈ°μ€€)
    • λ¨Όμ € λ„μ°©ν•œ ν”„λ‘œμ„ΈμŠ€λ₯Ό λ¨Όμ € 처리
  • μžμ› μ‚¬μš© μ œν•œ μ‹œκ°„(time quantum)이 있음
    • System parameter
    • ν”„λ‘œμ„ΈμŠ€λŠ” ν• λ‹Ήλœ μ‹œκ°„μ΄ μ§€λ‚˜λ©΄ μžμ› λ°˜λ‚©
      • Timer-run out
    • νŠΉμ • ν”„λ‘œμ„ΈμŠ€μ˜ μžμ› 독점(monopoly) 방지
    • Context switch overheadκ°€ 큼
  • λŒ€ν™”ν˜•, μ‹œλΆ„ν•  μ‹œμŠ€ν…œμ— 적합
  • Time quantum이 μ‹œμŠ€ν…œ μ„±λŠ₯을 κ²°μ •ν•˜λŠ” 핡심 μš”μ†Œ
    • Very large (infinite) -> FCFS
    • Very small time quantum -> processor sharing
      • μ‚¬μš©μžλŠ” λͺ¨λ“  ν”„λ‘œμ„ΈμŠ€κ°€ 각각의 ν”„λ‘œμ„Έμ„œ μœ„μ—μ„œ μ‹€ν–‰λ˜λŠ” κ²ƒμ²˜λŸΌ λŠλ‚Œ
        • 체감 ν”„λ‘œμ„Έμ„œ 속도 = μ‹€μ œ ν”„λ‘œμ„Έμ„œ μ„±λŠ₯의 1/n
      • High context switch overhead

사진 좜처 - https://youtu.be/r1JVA7yOPAM

  • Time-runout이 μΆ”κ°€λ˜μ—ˆλ‹€.
  • μ œν•œμ‹œκ°„μ΄ λλ‚˜λ©΄ λ‚˜μ™€μ„œ λ‹€μ‹œ 맨 뒀에 κ°€μ„œ 쀄을 μ„ λ‹€ (ready Q)
    사진 좜처 - https://youtu.be/r1JVA7yOPAM
  • νƒ€μž„ν€€ν…€(μ‹œκ°„ μ œν•œ) 2초
  • ν”„λ‘œμ„ΈμŠ€ 1번 λ„μ°©μ‹œ, 아무도 μ—†μ–΄μ„œ λ°”λ‘œ λ“€μ–΄κ°„λ‹€. 3μ΄ˆκ°€ ν•„μš”ν•œλ°, νƒ€μž„ν€€ν…€μ΄ 2초기 λ•Œλ¬Έμ— 2μ΄ˆλ™μ•ˆ 일을 ν•˜κ³  λ‚˜μ˜¨λ‹€.
  • 싀행이 λλ‚œ ν”„λ‘œμ„ΈμŠ€ 1λ²ˆμ€ λ‹€μ‹œ ready Q 맨 뒀에 쀄을 μ„ λ‹€.
  • ν”„λ‘œμ„ΈμŠ€ 2λ²ˆλ„ 2μ΄ˆλ™μ•ˆ 일을 ν•˜κ³  λ‚˜μ˜¨λ‹€. 5초의 μ‹œκ°„μ΄ λ‚¨λŠ”λ‹€. μž‘μ—…μ΄ λλ‚œ 2λ²ˆμ€ 맨 뒀에 쀄을 μ„ λ‹€.
  • μ΄λ ‡κ²Œ λŒμ•„κ°€λ©΄μ„œ νƒ€μž„ν€€ν…€μ— 따라 ν”„λ‘œμ„ΈμŠ€λ“€μ΄ μ‹€ν–‰λœλ‹€.

<μ°Έκ³ >

profile
https://rimi0108.github.io/

0개의 λŒ“κΈ€