From the course: IoT Foundations: Operating Systems Fundamentals

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Deadlock

Deadlock

From the course: IoT Foundations: Operating Systems Fundamentals

Start my 1-month free trial

Deadlock

- [Instructor] One issue of the task concurrent execution is, deadlock. It is a state that usually results from multiple tasks waiting for another task to make a move. It can happen when we mistakenly use an inter-task communication mechanism to access resources shared between tasks, or, it can happen on a single task. Let's see a typical example of when a deadlock happens. Suppose we have signals S1 and S2, and their resources R1 and R2, being held by Task 1 and Task 2, respectively. Now, Task 2 attempts to access the resource R1, taken by Task 1. But it needs the signal S1 from Task 1 to do so. And, Task 1 attempts to access the resource R2, held by Task 2, but still, it needs the signal S2 from Task 2. However, Task 2 did not get the signal S1, and now is in a blocked state; so did Task 1. In this situation, both tasks will be blocked and not get executed as we expected. A deadlock can be avoided if the tasks and their resources to be used are carefully checked. Any resource being…

Contents