[os] what is Deadlock?

숭글·2022년 10월 7일
0

Deadlock

Deadlock is a situation where two or more processes are waiting for each other.

there are Process1(P1) and Process2(P2), both of them need resource1, resource2 at the same time.
if P1 is having the resource1 and waiting for the resource2 while P2 is having the resource2 and waiting for the resource1. then P1 and P2 are infinitely waiting for each other to finish their work and release the resources.


four necessary conditions

there are four necessary conditions which cause the deadlock.

  • Mutual Exclution
    : A resource can be held by only one process at a time.

  • Hold and Wait
    : A process can hold a number of resources at a time and at the same time, it can request for other resources that are being held by some other process.

  • No preemption
    : A resource can't be preempted from the process by another process, forcefully.

  • Circular Wait
    : every process is waiting for each other to release the resource and no one is releasing their own resource.

profile
Hi!😁 I'm Soongle. Welcome to my Velog!!!

0개의 댓글