0% found this document useful (0 votes)
30 views

Assignment 4solution

This document contains solutions to quiz questions on distributed systems topics like deadlocks, consistency models, and minimum spanning trees. Key points addressed include: - In a wait for graph (WFG), a directed edge from P1 to P2 indicates that P1 is waiting for P2 to release a resource. - A deadlock exists if there is a directed cycle in the WFG. - Distributed deadlock detection algorithms like path-pushing and edge-chasing maintain global information to detect cycles. - The GHS algorithm computes a minimum spanning tree using at most 5N logN + 2E messages for a graph with N nodes and E edges.

Uploaded by

Sherin zafar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Assignment 4solution

This document contains solutions to quiz questions on distributed systems topics like deadlocks, consistency models, and minimum spanning trees. Key points addressed include: - In a wait for graph (WFG), a directed edge from P1 to P2 indicates that P1 is waiting for P2 to release a resource. - A deadlock exists if there is a directed cycle in the WFG. - Distributed deadlock detection algorithms like path-pushing and edge-chasing maintain global information to detect cycles. - The GHS algorithm computes a minimum spanning tree using at most 5N logN + 2E messages for a graph with N nodes and E edges.

Uploaded by

Sherin zafar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Quiz Assignment-IV Solutions: Distributed Systems (Week-4)

Q. 1 In wait for graph (WFG), a directed edge from node P1 to node P2 indicates that:

A. P1 is blocked and is waiting for P2 to release some resource


B. P2 is blocked and is waiting for P1 to release some resource
C. P1 is blocked and is waiting for P2 to leave the system
D. P2 is blocked and is waiting for P1 to leave the system

Ans: A) P1 is blocked and is waiting for P2 to release some resource

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.

Q. 2 In the wait for graph, if there exists a directed cycle or knot:

A. then a deadlock does not exist


B. then a deadlock exists
C. then the system is in a safe state
D. either b or c

Ans: B) then a deadlock exists

Explanation: A system is deadlocked if and only if there exists a directed cycle or knot in the
WFG.

Q. 3 Consider the following statements:

A deadlock detection algorithm must satisfy the following two conditions:

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.

A. Both conditions are true


B. Both conditions are false
C. Only condition 1 is true
D. Only condition 1 is true

Ans: B) Both conditions are false

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).

Q. 4 Consider the following regarding the models of deadlock:

Model of Deadlock Design Paradigm


(P) Single Resource (i) No assumptions are made regarding the underlying
Model structure of resource requests.
(Q) AND Model (ii) Presence of a knot indicates a deadlock.
(R) OR Model (iii) The out degree of a node in the WFG can be more than 1.
(S) Unrestricted model, (iv) Maximum out-degree of a node in a WFG can be 1

Match the deadlock models to the design paradigms they are based on.

A. (P): (i), Q: (ii), R: (iii), (S): (iv)


B. (P): (iv), Q: (iii), R: (ii), (S): (i)
C. (P): (iii), Q: (iv), R: (i), (S): (ii)
D. (P): (ii), Q: (iv), R: (i), (S): (iii)

Ans: B) (P): (iv), Q: (iii), R: (ii), (S): (i)

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.

OR Model: In the OR model, the presence of a knot indicates a deadlock.

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:

Statement 1: In path-pushing algorithms, distributed deadlocks are detected by maintaining


an explicit global WFG. The basic idea is to build a global WFG for each site of the
distributed system.

Statement 2: In an edge-chasing algorithm, the presence of a cycle in a distributed graph


structure is be verified by propagating special messages called probes, along the edges of
the graph. These probe messages are different than the request and reply messages.

A. Both statements are true


B. Both statements are false
C. Only statement 1 is true
D. Only statement 2 is true

Ans: A) Both statements are true

Q. 6 Consider the following statements related to consistency models:

(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.

A. All are True


B. All are False
C. Only (i) and (iii) are true
D. Only (ii) is true

Ans: D) Only (ii) is true

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

Ans: A) Weak consistency

Q. 8 The space complexity is the ____________registers and time complexity is


________time for n-process bakery algorithm of shared memory mutual exclusion

A. Upper bound of n, O(n2)


B. Upper bound of n, O(n)
C. Lower bound of n, O(n)
D. Lower bound of n, O(n2)

Ans: C) Lower bound of n, O(n)

Explanation: For Bakery algorithm

Space complexity: lower bound of n registers

Time complexity: O(n) time

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:

A. Weight outgoing edge (WOE)


B. Least weight outgoing edge (LWOE)
C. Link outgoing weight edge (LOWE)
D. Minimum weight outgoing edge (MWOE)

Ans: D) Minimum weight outgoing edge (MWOE)

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|

Ans: D) At most 5N logN + 2|E|

Explanation: The upper bound of GHS algorithm is 5N logN + 2|E|

Q. 11 Consider the following properties of minimum spanning tree (MST):

MST Property 1: Given a fragment of an MST, let e be a minimum-weight outgoing edge of


the fragment. Then joining e and its adjacent non-fragment node to the fragment yields
another fragment of an MST.

MST Property 2: If all the edges of a connected graph have same weights, then the MST is
unique.

A. Both are true


B. Both are false
C. Only property 1 is true
D. Only property 2 is true

Ans: C) Only property 1 is true

Explanation: MST Property 1: Given a fragment of an MST, let e be a minimum-weight


outgoing edge of the fragment. Then joining e and its adjacent non-fragment node to the
fragment yields another fragment of an MST.

MST Property 2: If all the edges of a connected graph have different weights, then the MST
is unique.

You might also like