๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โญ Group_Study/Operating System

[4์ฃผ์ฐจ] Deadlock: Deadlock Prevention

by ํฌ์ŠคํŠธ์‰์ดํฌ 2022. 12. 26.

Deadlock: Deadlock Prevention

Deadlock ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

  1. Deadlock prevention methods (์˜ˆ๋ฐฉ)
  2. Deadlock avoidance methods(ํšŒํ”ผ)
  3. Deadlock detection and deadlock recovery methods(ํƒ์ง€ ๋ฐ ๋ณต๊ตฌ)

Deadlock Prevention

โœ” 4๊ฐœ์˜ deadlock ๋ฐœ์ƒ ํ•„์š” ์กฐ๊ฑด ์ค‘ ํ•˜๋‚˜๋ฅผ ์ œ๊ฑฐ

  1. Exclusive use of resources
  2. Non - preemptible resources
  3. Hold and Wait(Partial allocation)
  4. Circular wait

โœ” Deadlock์ด ์ ˆ๋Œ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค

1. ๋ชจ๋“  ์ž์› ๊ณต์œ  ํ—ˆ์šฉ

โœ” Exclusive use or resources ์กฐ๊ฑด ์ œ๊ฑฐ
โœ” ํ˜„์‹ค์ ์œผ๋กœ ๋ถˆ๊ฐ€๋Šฅ

2. ๋ชจ๋“  ์ž์›์— ๋Œ€ํ•œ ์„ ์  ํ—ˆ์šฉ

โœ” Non-preemptible resources ์กฐ๊ฑด ์ œ๊ฑฐ
โœ” ํ˜„์‹ค์ ์œผ๋กœ ๋ถˆ๊ฐ€๋Šฅ

โœ” ์œ ์‚ฌํ•œ ๋ฐฉ๋ฒ•

  • ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ• ๋‹น ๋ฐ›์„ ์ˆ˜ ์—†๋Š” ์ž์›์„ ์š”์ฒญํ•œ ๊ฒฝ์šฐ, ๊ธฐ์กด์— ๊ฐ€์ง€๊ณ  ์žˆ๋˜ ์ž์›์„ ๋ชจ๋‘ ๋ฐ˜๋‚ฉํ•˜๊ณ  ์ž‘์—… ์ทจ์†Œ
    • ์ดํ›„ ์ฒ˜์Œ(or check-point)๋ถ€ํ„ฐ ๋‹ค์‹œ ์‹œ์ž‘
  • ์‹ฌ๊ฐํ•œ ์ž์› ๋‚ญ๋น„ ๋ฐœ์ƒ -> ๋น„ํ˜„์‹ค์ 

3. ํ•„์š”ํ•œ ์ž์šด ํ•œ๋ฒˆ์— ๋ชจ๋‘ ํ• ๋‹น(Total allocation)

โœ” Hold and wait ์กฐ๊ฑด ์ œ๊ฑฐ
โœ” ์ž์› ๋‚ญ๋น„ ๋ฐœ์ƒ

  • ํ•„์š”ํ•˜์ง€ ์•Š์€ ์ˆœ๊ฐ„์—๋„ ๊ฐ€์ง€๊ณ  ์žˆ์Œ

โœ” ๋ฌดํ•œ ๋Œ€๊ธฐ ํ˜„์ƒ ๋ฐœ์ƒ ๊ฐ€๋Šฅ

4. Circular wait ์กฐ๊ฑด ์ œ๊ฑฐ

โœ” Totally allocation์„ ์ผ๋ฐ˜ํ™” ํ•œ ๋ฐฉ๋ฒ•
โœ” ์ž์›๋“ค์—๊ฒŒ ์ˆœ์„œ๋ฅผ ๋ถ€์—ฌ
โœ” ํ”„๋กœ์„ธ์Šค๋Š” ์ˆœ์„œ์˜ ์ฆ๊ฐ€ ๋ฐฉํ–ฅ์œผ๋กœ๋งŒ ์ž์› ์š”์ฒญ ๊ฐ€๋Šฅ
โœ” ์ž์› ๋‚ญ๋น„ ๋ฐœ์ƒ

๋Œ“๊ธ€