Skip to content

Deadlock Detection - Banker’s 알고리즘에서 safe state 판단 방식 #24

Answered by LEEHYUNDONG
guswns3371 asked this question in Q&A
Discussion options

You must be logged in to vote

@guswns3371
안녕하세요. 현준님 오늘 만나긴 하지만? 글을 보게되어 제가 이해한 것을 토대로 한 번 떠들어 보겠슴다!

정보

  • 5 processes :P0, P1, P2, P3, P4
  • 3 resource types : A(7), B(2), C(6)

detection의 경우 ! 제가 이해한 포인트는

  1. allocation의 크기와 request를 참고하여 available한 자원 파악
  2. deadlock을 유발하지 않는 순서쌍이 존재하는지 파악

그러면 적어놓으신 표를 보고 하나씩 살펴보면
우선 available이 (0, 0, 0)입니다.
request에 (0, 0, 0)인 프로세스가 없으면 무조건 데드락 상태를 유발합니다.
하지만 프로세스 P0, P2는 request가 (0, 0, 0)이네요 그럼 순서를 P0 -> P2 or P2 -> P0로 해볼 수 있습니다.
그럼 자원을 P0, P2를 모두 수행하고 반환된 자원들로 인하여 available 상태는 (3, 1, 3)이 됩니다.
이후에 가용자원(available) (3, 1, 3) 보다 작은 쌍을 가지고 있는 프로세스는 P3가 있습니다. P1도 있구요.

이런식으로 찾아가다보면 <P2, P0, P3, P1, P4> 의 순서로 자원을 할당하면 deadlock이 발생하지 않을 거같아요.
그래서 detection은 safe한 seq를 보장하는 프로세스를 detect하면서 deadl…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@guswns3371
Comment options

guswns3371 Apr 6, 2022
Maintainer Author

@guswns3371
Comment options

guswns3371 Apr 6, 2022
Maintainer Author

Answer selected by guswns3371
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants