The wait-for graph scheme is not applicable to a resource-allocation system with multiple instances of each resource type. We need a deadlock detection algorithm that is applicable to such a system. The algorithm employs several time-varying data structure that are similar to those used in the banker’s algorithm.  Available. A vector of length ? indicates the number of available resources of each type.  Allocation: An ? × ? matrix defines the number of resources of each type currently allocated to each thread  Request: An ? × ? matrix indicates the current request of each thread. If Request[i][ j] equals ?, then thread ?i is requesting ? more instances of resource type ?j The ≤ relation between two vectors denotes as follows: Let ? and ? be vectors of length ?. We say that ? ≤ ? if and only if ?[?] ≤ ?[?] for all ? = 1,2, . . , ?. For example, if ? = (1,7,3,2) and ? = (0,3,2,1), then ? ≤ ?. In addition, ? < ? if ? ≤ ? and ? ≠ ?. We can treat each row in the matrices ?????????? and ??????? as vectors and refer to them as ??????????? and ????????. The vector ??????????? specifies the resources currently allocated to thread ?i; the vector ???????? specifies the resources requested by thread ?i. This detection algorithm simply investigates every possible allocation sequence for the threads that remain to be completed. The following is the Deadlock Detection algorithm we want to study in this assignment. 1. Let Work and Finish be vectors of length m and n, respectively. Initialize Work = Available. For i = 0, 1, ..., n-1, if Allocation, # 0, then Finish i] = false. Otherwise, Finish|i] = true. 2. Find an index i such that both       a. Finishi] == false       b. Request; ≤ Work If no such i exists, go to step 4. 3.  Work = Work + Allocation;      Finish il = true      Go to step 2. 4. If Finish[i] == false for some i, 0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The wait-for graph scheme is not applicable to a resource-allocation system with multiple instances of each
resource type. We need a deadlock detection algorithm that is applicable to such a system. The algorithm employs
several time-varying data structure that are similar to those used in the banker’s algorithm.


 Available. A vector of length ? indicates the number of available resources of each type.
 Allocation: An ? × ? matrix defines the number of resources of each type currently allocated to each
thread
 Request: An ? × ? matrix indicates the current request of each thread. If Request[i][ j] equals ?, then
thread ?i is requesting ? more instances of resource type ?j
The ≤ relation between two vectors denotes as follows:
Let ? and ? be vectors of length ?. We say that ? ≤ ? if and only if ?[?] ≤ ?[?] for all ? = 1,2, . . , ?. For example,
if ? = (1,7,3,2) and ? = (0,3,2,1), then ? ≤ ?. In addition, ? < ? if ? ≤ ? and ? ≠ ?.


We can treat each row in the matrices ?????????? and ??????? as vectors and refer to them as ???????????
and ????????. The vector ??????????? specifies the resources currently allocated to thread ?i; the vector ????????
specifies the resources requested by thread ?i.

This detection algorithm simply investigates every possible allocation sequence for the threads that remain to be
completed. The following is the Deadlock Detection algorithm we want to study in this assignment.

1. Let Work and Finish be vectors of length m and n, respectively. Initialize Work = Available. For i = 0, 1, ..., n-1, if Allocation, # 0, then Finish i] = false. Otherwise, Finish|i] = true.
2. Find an index i such that both
      a. Finishi] == false
      b. Request; ≤ Work
If no such i exists, go to step 4.
3.  Work = Work + Allocation;
     Finish il = true
     Go to step 2.
4. If Finish[i] == false for some i, 0 <i < n, then the system is in a deadlocked state. Moreover, if Finish i] == false, then thread T, is deadlocked.

1. Solve the following problem. Consider a system with five threads ?? through ?? and three resource types
A, B, and C. Resource type A has seven instances, resource type B has two instances, and resource type C has
six instances.


       ??????????   ???????   ?????????
            A B C                 A B C            A B C
?0     0 1 0                 0 0 0                0 0 0
?1      2 0 0                 2 0 2
?2      3 0 3                 0 0 0
?3     2 1 1                 1 0 0
?4      0 0 2                 0 0 2

1) Answer whether the system below is in the deadlock state. If there does not exist a deadlock state, solve the problem using the algorithm presented above and write down the process in detail and find the sequence in which the system works without a deadlock. If there exists a deadlock, write down all the threads, consisting of the deadlock.

2) Suppose now that ?2 makes one additional request for an instance of type C. That is, the ??????? matrix is modified as follows:

           ???????
               A B C
?0          0 0 0
?1          2 0 2
?2          0 0 1
?3         1 0 0
?4         0 0 2

Answer whether the system below is in the deadlock state. If there does not exist a deadlock state, solve
the problem using the algorithm presented above and write down the process in detail and find the
sequence in which the system works without a deadlock. If there exists a deadlock, write down all the
threads, consisting of the deadlock

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps

Blurred answer
Knowledge Booster
Quicksort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education