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

[4์ฃผ์ฐจ] Deadlock: Deadlock and Resource types

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

Deadlock: Deadlock and Resource types

Deadlock์˜ ๊ฐœ๋…

โœ” Blocked/Asleep state

  • ํ”„๋กœ์„ธ์Šค๊ฐ€ ํŠน์ • ์ด๋ฒคํŠธ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ
  • ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•„์š”ํ•œ ์ž์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ

โœ” Deadlock state

  • ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์ด ์—†๋Š” ์ด๋ฒคํŠธ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๊ฒฝ์šฐ
    • ํ”„๋กœ์„ธ์Šค๊ฐ€ deadlock ์ƒํƒœ์— ์žˆ์Œ
  • ์‹œ์Šคํ…œ ๋‚ด์— deadlock์— ๋น ์ง„ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ
    • ์‹œ์Šคํ…œ์ด deadlock์ด ์ƒํƒœ์— ์žˆ์Œ

โœ” starvation์€ '์šด์ด ์—†์–ด์„œ' ํ”„๋กœ์„ธ์„œ๋ฅผ ํ• ๋‹น๋ฐ›์ง€ ๋ชปํ•œ ์ƒํƒœ์ผ ๋ฟ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์ด ์—†๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๋‹ค!!

์ž์›์˜ ๋ถ„๋ฅ˜

โœ” ์ผ๋ฐ˜์  ๋ถ„๋ฅ˜: Hardware resources vs Software resources

โœ” ๋‹ค๋ฅธ ๋ถ„๋ฅ˜๋ฒ•(deadlock์˜ ๊ด€์ )

  • ์„ ์  ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜
  • ํ• ๋‹น ๋‹จ์œ„์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜
  • ๋™์‹œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜
  • ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜

์„ ์  ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜

โœ” Preemptible Resources

  • ์„ ์  ๋‹นํ•œ ํ›„, ๋Œ์•„์™€๋„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š” ์ž์›
  • Processor, memory ๋“ฑ

โœ” Non-preemptible resources

  • ์„ ์  ๋‹นํ•˜๋ฉด, ์ดํ›„ ์ง„ํ–‰์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ์ž์›
    • Rollback, restart๋“ฑ ํŠน๋ณ„ํ•œ ๋™์ž‘์ด ํ•„์š”
  • disk drive ๋“ฑ

ํ• ๋‹น ๋‹จ์œ„์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜

โœ” Total allocation resources

  • ์ž์› ์ „์ฒด๋ฅผ ํ”„๋กœ์„ธ์Šค์—๊ฒŒ ํ• ๋‹น
  • Processor, disk drive ๋“ฑ

โœ” Partitioned allocation resources

  • ํ•˜๋‚˜์˜ ์ž์›์„ ์—ฌ๋Ÿฌ ์กฐ๊ฐ์œผ๋กœ ๋‚˜๋ˆ„์–ด, ์—ฌ๋Ÿฌ ํ”„๋กœ์„ธ์Šค์—๊ฒŒ ํ• ๋‹น
  • Memory ๋“ฑ

๋™์‹œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜

โœ” Exclusive allocation resources

  • ํ•œ ์ˆœ๊ฐ„์— ํ•œ ํ”„๋กœ์„ธ์Šค๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ž์›
  • Processor, memory, disk drive ๋“ฑ

โœ” Shared allocation resources

  • ์—ฌ๋Ÿฌ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋™์‹œ์— ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ž์›
  • Program(sw), shared data ๋“ฑ

์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€์— ๋”ฐ๋ฅธ ๋ถ„๋ฅ˜

โœ” SR(Serially-reusable Resources)

  • ์‹œ์Šคํ…œ ๋‚ด์— ํ•ญ์ƒ ์กด์žฌํ•˜๋Š” ์ž์›
  • ์‚ฌ์šฉ์ด ๋๋‚˜๋ฉด, ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • Processor, memory, disk drive, program ๋“ฑ

โœ” CR (Consumable Resources)

  • ํ•œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‚ฌ์šฉํ•œ ํ›„์— ์‚ฌ๋ผ์ง€๋Š” ์ž์›
  • signal, message ๋“ฑ

Deadlock๊ณผ ์ž์›์˜ ์ข…๋ฅ˜

โœ” Deadlock์„ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” ์ž์›์˜ ํ˜•ํƒœ

  • Non-preemptible resources
  • Exclusive allocation resources
  • Serially resusable resources
  • ํ• ๋‹น ๋‹จ์œ„๋Š” ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š๋Š”๋‹ค!

โœ” CR์„ ๋Œ€์ƒ์œผ๋กœ ํ•˜๋Š” Deadlock model

  • ๋งค์šฐ ๋ณต์žก!

๋Œ“๊ธ€