Assignment 4solution
Assignment 4solution
Q. 1 In wait for graph (WFG), a directed edge from node P1 to node P2 indicates that:
Explanation: The state of the system can be modeled by directed graph, called a wait for
graph (WFG). In a WFG , nodes are processes and there is a directed edge from node P1 to
node P2 if P1 is blocked and is waiting for P2 to release some resource.
Explanation: A system is deadlocked if and only if there exists a directed cycle or knot in the
WFG.
Condition 1: Progress (No false deadlocks): The algorithm should not report deadlocks
which do not exist.
Condition 2: Safety (No undetected deadlocks): The algorithm must detect all existing
deadlocks in finite time.
Explanation: A deadlock detection algorithm must satisfy the following two conditions:
(i)Progress (No undetected deadlocks): The algorithm must detect all existing deadlocks in
finite time. In other words, after all wait-for dependencies for a deadlock have formed, the
algorithm should not wait for any more events to occur to detect the deadlock.
(ii)Safety (No false deadlocks): The algorithm should not report deadlocks which do not exist
(called phantom or false deadlocks).
Match the deadlock models to the design paradigms they are based on.
Explanation:
The Single Resource Model: In the single resource model, a process can have at most one
outstanding request for only one unit of a resource. Since the maximum out-degree of a
node in a WFG for the single resource model can be 1, the presence of a cycle in the WFG
shall indicate that there is a deadlock.
The AND Model: In the AND model, a process can request for more than one resource
simultaneously and the request is satisfied only after all the requested resources are
granted to the process. The out degree of a node in the WFG for AND model can be more
than 1.
Unrestricted Model: In the unrestricted model, no assumptions are made regarding the
underlying structure of resource requests. Only one assumption that the deadlock is stable
is made and hence it is the most general model.
Q. 5 Consider the following statements related to distributed deadlock detection algorithms:
(i) Strict consistency (SC): Only Write operations issued by the same processor and to the
same memory location must be seen by others in that order.
(ii) PRAM memory: Only Write operations issued by the same processor are seen by others
in the order they were issued, but Writes from different processors may be seen by other
processors in different orders.
(iii) Slow Memory: Any Read to a location (variable) is required to return the value written
by the most recent Write to that location (variable) as per a global time reference.
Explanations: (i) Strict consistency (SC): Any Read to a location (variable) is required to
return the value written by the most recent Write to that location (variable) as per a global
time reference.
(ii) PRAM memory: Only Write operations issued by the same processor are seen by others
in the order they were issued, but Writes from different processors may be seen by other
processors in different orders.
(iii) Slow Memory: Only Write operations issued by the same processor and to the same
memory location must be seen by others in that order.
Q. 7 Choose the correct consistency model that defines the following conditions:
I. All Writes are propagated to other processes, and all Writes done elsewhere are
brought locally, at a sync instruction.
II. Accesses to sync variables are sequentially consistent
III. Access to sync variable is not permitted unless all Writes elsewhere have completed
IV. No data access is allowed until all previous synchronization variable accesses have
been performed
A. Weak consistency
B. Causal consistency
C. Processor consistency
D. Program consistency
Q. 9 In GHS algorithm for Minimum Spanning Tree (MST), an edge adjacent to the fragment
with smallest weight and that does not create a cycle is called as:
Explanation: Minimum weight outgoing edge (MWOE) An edge adjacent to the fragment
with smallest weight and that does not create a cycle.
Q. 10 The GHS algorithm computes the minimum spanning tree using
___________messages for a graph of N nodes and E edges
A. Atleast 2|E|
B. Atleast 5N logN
C. Atmost 3NlogN + 2|E|
D. Atmost 5N logN + 2|E|
MST Property 2: If all the edges of a connected graph have same weights, then the MST is
unique.
MST Property 2: If all the edges of a connected graph have different weights, then the MST
is unique.