0
5.5kviews
Describe deadlock in RTOS with suitable example.
1 Answer
0
653views

A deadlock consists of a set of blocked processes, each holding a resource and waiting to acquire a resource held by another process in the set

A deadlock, also called as deadly embrace, is a situation in which two threads are each unknowingly waiting for resource held by other.

Example #1 A system has 2 disk drives P1 and P2 each hold one disk drive and each need the other one.

Example #2 Semaphores A and B, initialized to 1

P0 P1
wait (A); wait(B)
wait (B); wait(A)

enter image description here

  • Task #1 wants the scanner while holding the printer. Task #1 cannot proceed until both the printer and the scanner are in its possession.
  • Task #2 wants the printer while holding the scanner. Task #2 cannot continue until it has the printer and the scanner.
Please log in to add an answer.