rows represent the tasks belonging to the deadlocked set. The algorithm is illustrated in the following example.
N = | 4 | 6 | 2 | |
A = | 1 | 2 | 0 | |
C = | 0 | 2 | 0 | Task 1 |
1 | 1 | 0 | Task 2 | |
1 | 1 | 1 | Task 3 | |
1 | 0 | 1 | Task 4 | |
D = | 2 | 2 | 2 | Task 1 |
1 | 1 | 0 | Task 2 | |
0 | 1 | 0 | Task 3 | |
1 | 1 | 1 | Task 4 |
Step 1: Task 1 cannot continue because the available resources do not satisfy its requirements.
Task 2 can continue because what it needs can be met.
Step 2: | A = 2 | 3 | 0 |
Step 3: Task 1, task 3, and task 4 remain. Return to step 1.
Step 1: Task 1 still cannot continue. The requirement from task 3 can be met.
Step 2: | A = 3 | 4 | 1 |
Step 3: Task 1 and task 4 remain. Return to step 1.
Step 1: Task 1 still cannot continue, but task 4 can.
Step 2: | A = 4 | 4 | 2 |
Вы читаете Real-Time Concepts for Embedded Systems