Deadlock: Deadlock Avoidance
Deadlock Avoidance: κ°μ
β μμ€ν μ μνλ₯Ό κ³μ κ°μ
β μμ€ν μ΄ deadlock μνκ° λ κ°λ₯μ±μ΄ μλ μμ ν λΉ μμ² λ³΄λ₯
β μμ€ν μ νμ safe stateλ‘ μ μ§
Safe State
β Safe state
- λͺ¨λ νλ‘μΈμ€κ° μ μμ μ’ λ£ κ°λ₯ν μν
- Safe sequenceκ° μ‘΄μ¬
- Deadlock μνκ° λμ§ μμ μ μμμ 보μ₯
β Unsafe state
- Deadlock μνκ° λ κ°λ₯μ±μ΄ μμ
- λ°λμ λ°μνλ€λ μλ―Έλ μλλ€
κ°μ
β νλ‘μΈμ€μ μκ° κ³ μ λ¨
β μμμ μ’
λ₯μ μκ° κ³ μ λ¨
β νλ‘μΈμ€κ° μꡬνλ μμ λ° μ΅λ μλμ μκ³ μμ
β νλ‘μΈμ€λ μμμ μ¬μ© ν λ°λμ λ°λ©
β Not practical
Algorithms
- Dijkstra's algorithm (Banker's algorithm)
- Habermann's algorithm
Dijkstar's Banker's algorithm
β Deadlock avoidanceλ₯Ό μν κ°λ¨ν μ΄λ‘ μ κΈ°λ²
β κ°μ : ν μ’ λ₯μ μμμ΄ μ¬λ¬ κ°
β μμ€ν μ νμ safe stateλ‘ μ μ§
β 1 resource type R, 10 resource units, 3 processes
safe state example
unsafe state example
β μμ μμ² μ΄νμλ safe stateκ° μ μ§λ μ μμΌλ©΄ μμ² μΉλ
β μμ μμ² μ΄νμ unsafe stateκ° λλ©΄ μμ² κ±°μ
Habermann's algorithms
β Dijkstar's algorithmμ νμ₯
β μ¬λ¬ μ’
λ₯μ μμ κ³ λ €
- Multiple resource types
- Multiple resource units for each resource type
β μμ€ν μ νμ safe stateλ‘ μ μ§
Example
β 3 types of resource: $R_a, R_b, R_c$
β Number of resouce units for each type: (10, 5, 7)
β 5 processes
β Dijkstra's algorithmκ³Ό κΈ°λ³Έ μ리λ λμΌνλ€ (safe -> accept / unsafe -> reject)
Deadlock Avoidance μ 리
β Deadlockμ λ°μμ λ§μ μ μμ
β High overhead
- μμ€ν μ νμ κ°μνκ³ μμ΄μΌ νλ€
β Low resource utilization
- Safe state μ μ§λ₯Ό μν΄, μ¬μ© λμ§ μλ μμμ΄ μ‘΄μ¬
β Not practical
- λΉνμ€μ κ°μ
- νλ‘μΈμ€ μ, μμ μκ° κ³ μ
- νμν μ΅λ μμ μλ₯Ό μκ³ μμ
'β Group_Study > Operating System' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[5μ£Όμ°¨] Memory Management: Backgrounds (0) | 2023.01.02 |
---|---|
[4μ£Όμ°¨] Deadlock: Deadlock Detection and Recovery (1) | 2022.12.29 |
[4μ£Όμ°¨] Deadlock: Deadlock Prevention (0) | 2022.12.26 |
[4μ£Όμ°¨] Deadlock: Deadlock Model (0) | 2022.12.23 |
[4μ£Όμ°¨] Deadlock: Deadlock and Resource types (0) | 2022.12.22 |
λκΈ