0% found this document useful (0 votes)
9 views6 pages

APOS Assignment 2 Updated

The document contains an assignment for a course on Advanced Operating Systems, focusing on various algorithms for distributed mutual exclusion, deadlock detection, and load distribution. It includes questions on Lamport’s algorithm, Ricart-Agrawala algorithm, Suzuki Kasami’s Broadcast algorithm, and Raymond’s tree-based algorithm, along with definitions and comparisons of deadlocks and distributed file systems. Additionally, it discusses performance measurement criteria for mutual exclusion algorithms and the components of load distributing algorithms.

Uploaded by

NOOB4 LIFE
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

APOS Assignment 2 Updated

The document contains an assignment for a course on Advanced Operating Systems, focusing on various algorithms for distributed mutual exclusion, deadlock detection, and load distribution. It includes questions on Lamport’s algorithm, Ricart-Agrawala algorithm, Suzuki Kasami’s Broadcast algorithm, and Raymond’s tree-based algorithm, along with definitions and comparisons of deadlocks and distributed file systems. Additionally, it discusses performance measurement criteria for mutual exclusion algorithms and the components of load distributing algorithms.

Uploaded by

NOOB4 LIFE
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NED UNIVERSITY OF ENGINEERING & TECHNOLOGY

CT-576 Advanced Operating System


Assignment # 2
Due Date: December 16, 2023
Question # 1 Show that in Lamport’s algorithm if a site S1 is executing the critical section,
then S2 and S3.

S1

S2

S3

S4

Question # 2 Show that in Ricart-Agrawala algorithm if a site S4 is executing the critical


section, then S2 and S1.
S1

S2

S3

S4

Question # 3 Consider a distributed system in which using Suzuki Kasami’s Broadcast


algorithm to implement distributed mutual exclusion. Show the movement
of token for the following set of processes. Suppose S3 and S4 request for the
token simultaneously.
Suppose Initial Condition S3 & S4 request for token
S1 1 0 1 2 LN S1 LN

S2 1 0 1 2 S2

S3 1 0 1 2 S3
Token Queue Token Queue
S4 1 0 1 2 S4

S1 LN S1 LN

S2 S2

S3 S3
Token Queue Token Queue
S4 S4

S1 LN S1 LN

S2 S2

S3 S3
Token Queue Token Queue
S4 S4
Question # 4 Consider a distributed system in which using Raymond’s tree-based
algorithm to implement distributed mutual exclusion. Identify the root and
show the movement of token for the following set of processes. Suppose S1
and S8 request for the token simultaneously.
Step # 1 Step # 2 Step # 3
S1 S1 S1
S2 S8 S2 S8 S2 S8

S6 S6 S6
S3 S3 S3
S7 S7 S7
S4 S4 S4
S5 S5 S5

Step # 4 Step # 5 Step # 6


S1 S1 S1
S2 S8 S2 S8 S2 S8

S6 S6 S6
S3 S3 S3
S7 S7 S7
S4 S4 S4
S5 S5 S5

Step # 7 Step # 8 Step # 9


S1 S1 S1
S2 S8 S2 S8 S2 S8

S6 S6 S6
S3 S3 S3
S7 S7 S7
S4 S4 S4
S5 S5 S5

Step # 10 Step # 11 Step # 12


S1 S1 S1
S2 S8 S2 S8 S2 S8

S6 S6 S6
S3 S3 S3
S7 S7 S7
S4 S4 S4
S5 S5 S5
Question # 5 Define the term false deadlock. Distinguish between resource deadlock and
communication deadlock?

Answer:

• False Deadlock:
This happens when a system falsely detects a deadlock that isn't there, frequently as a
result of flaws in the deadlock detection algorithms.

• Resource Deadlock:
When processes in a multi-process system repeatedly wait for resources that each other is
holding, it can cause a standstill.

• Communication Deadlock:
In a distributed system, communication deadlock happens when processes become
impervious to one another's messages by becoming caught in a never-ending cycle of
waiting for them.

Question # 6 What is a distributed file system? What are its basic goals? Show the data
access actions in a DFS
Answer:

A file system that stores and manages files across numerous servers or network nodes is known as
a distributed file system (DFS). A distributed file system's main objectives are to ensure fault
tolerance, scalability, and the efficient access and sharing of data throughout a distributed
environment. It also provides a unified and coherent view of file storage. Basic goals of a
Distributed File System are as follows

1) Openness: Location Transparency: File locations shouldn't be visible to users or applications.


Regardless of where the data is kept, they can access files using a standard interface.

2) Replication Transparency: Users shouldn't be aware of file replicas that the system may be
using across several nodes for fault tolerance. The file appears to them in a single logical
copy.

3) Fault Tolerance: The system ought to withstand network problems or node failures. To
guarantee data availability and integrity in the event of failures, redundancy, data replication,
and recovery techniques are used.

4) Scalability: As the quantity of users, files, and nodes increases, the DFS ought to expand
smoothly. It ought to allow for the expansion of storage capacity and nodes without suffering
appreciable performance drops.

Data Access Actions in a DFS are as follows:

1) File Creation and Deletion:


2) File Reading and Writing:
3) File Access Control:
4) File Replication
Question # 7 What are the performance measurement criteria for distributed mutual
exclusion algorithm? Compare token-based and non-token based algorithm
in term of these parameters.
Answer

• No deadlock: Websites shouldn't have to wait an endless amount of time for a message
that isn't going to arrive.
• No Starvation: A threshold ought to be established so that one site is unable to
continuously execute a crucial section while another waits to do so.
• Fault Tolerance: It ought to be able to recognize when it is failing on its own and
resume operation with minimal disruption.

Tokens based Methodology: In this approach, each site shares a unique token, also referred to as
the PRIVILEGE message. Assuming a site has the token, it can proceed to its
critical section and maintain it there until the critical section's execution is
complete. Because the token is unique, mutual exclusion is ensured. Considering
this method, the algorithms essentially vary in how a website sends out the quest
for the token.
Non-token-based methodology: To determine which site will move on to the crucial part next,
at least two progressive rounds of messages are sent back and forth between the
sites. The moment a declaration, defined by its local factors, becomes valid, a site
enters the critical section.

Question # 8 Briefly explain the different components of a load distributing algorithm?

Answer

A load distributing algorithm has 4 components –

• Transfer Policy: Determine whether or not a node is in a suitable state for a task transfer.
• Process Selection Policy: Determines the task to be transferred.
• Site Location Policy: Determines the node to which a task should be transferred to when
it is selected for transfer.
• Information Policy: It is in-charge of initiating the gathering of system state data.

Question # 9 Differentiate between sender-initiated algorithm and receiver-initiated


algorithm?
Answer

• Starting Point:
Sender-Initiated: The communication is started by the sender.
Receiver-Initiated: The communication is started by the recipient.

• Regulate Flow:
Sender-Initiated: The sender decides what information is sent and when it is sent.
Receiver-Initiated: When and what information is requested is at the receiver's discretion.
• Sample Situations:
Sender-Initiated: Client-server correspondence in which the clients ask the server for
services.
Receiver-Initiated: Systems that are triggered by events that come from outside sources.

• Adaptability and Reactivity:


Sender-Initiated: Provides the sender with control, which is advantageous for sending
data right away.
Receiver-Initiated: Offers flexibility by letting the recipient choose when to make an
information request, enabling responsive systems.

Question # 10 What are the two most important services of Distributed File Server?

Answer

File replication: This service entails making multiple copies of a file, which are then stored on
various distributed file system nodes or servers. The goal of file replication is to
increase the dependability and availability of data.

File access Transparency: This service guarantees that users can access files in a distributed file
system without being aware of the files' exact location or method of distribution.

Question # 11 Suppose you are design a Distributed system using the 100 computing site.
For better working you are decided a deadlock detection system. there are
three of type of DDD control strategy, which type of DDD control
mechanism would you suggest.
Answer

• The size of 100 computing sites suggests that a hierarchical DDD control mechanism would
be a good option. It offers a middle ground between the dispersed nature of decentralized
control and the ease of use of centralized control. The implementation of a hierarchical
structure has the potential to mitigate scalability issues, enhance fault tolerance, and facilitate
complexity management within the system.
Question # 12 Apply Chandy-Misra-Haas edge-chasing and path-pushing algorithm on the
following scenario?

P1 P2 P6 P7

Site 1 Site 2
P3 P4 P5 P8

P20 P17 P16 P13 P12 P9

Site 3 Site 4 Site 5


P19 P18 P15 P14 P11 P10

Common questions

Powered by AI

The 'Process Selection Policy' in a load distributing algorithm determines which task should be transferred when the need arises. This policy assesses the currently available tasks based on certain criteria, such as computational demand or data locality. It ensures that the system performs optimally by selecting tasks that best fit the current state of system resources or load distribution goals, such as minimizing response time and maximizing throughput. Effective process selection is critical to maintaining balance and efficiency within a distributed system's workflows.

A Distributed File System (DFS) ensures data consistency across replicas through replication protocols that synchronize updates among copies held on different nodes. Strategies like quorum-based approaches require a majority agreement before updates are executed, ensuring consistency while balancing load across systems. Providing transparency relies on keeping the replication process hidden from users, presenting a single unified file view. However, implementing such methods must address the trade-off between availability, performance, and consistency, as perfect synchronization can impact performance if not managed efficiently. The DFS aims to minimize this impact while maintaining the illusion of a single coherent data service.

In Suzuki-Kasami's Broadcast Algorithm, when multiple sites, such as S3 and S4, simultaneously request the token, each site broadcasts its request to all other sites. Each site maintains a data structure that includes a sequence number for each site and a token queue. If a site holds the token when receiving these requests, it updates the sequence numbers for S3 and S4 in the token and enqueues them if they are not already present in the token request queue. If another site receives a request while it holds the token, it grants the token to the site with the highest sequence number in its request queue, ensuring fair access.

Implementing a receiver-initiated load distribution algorithm in a dynamic network environment allows sites with less load to solicit tasks, adapting to real-time network conditions. This helps balance loads quickly as idle nodes request work, enhancing efficiency and reducing response time. Receiver-initiated systems enable more flexible resource use, potentially responding to network stress more agilely than sender-initiated approaches. However, they require timely status information to function efficiently and may introduce overhead if nodes frequently poll or initiate requests without sufficient computation task availability. Therefore, optimizing the polling strategy is crucial to maintain performance without excessive communication overhead.

Lamport's algorithm ensures the sequential execution of critical sections by using logical timestamps and a request queue. When a site wants to enter a critical section, it sends a request, timestamped with its logical clock, to all other sites and places this request into a local request queue. Sites acknowledge receiving the request and update their logical clocks. A site enters its critical section only if its request has the earliest timestamp in its request queue and it has received replies from all other sites that haven't made earlier requests. This prevents simultaneous execution, as all sites agree on the order of requests based on timestamps, ensuring sequential execution.

The Ricart-Agrawala algorithm has a message complexity of 2(n-1) per critical section entry, as each site must receive a reply from every other site before entering the critical section. In contrast, Lamport's algorithm requires 3(n-1) messages per entry: one request, n-1 acknowledgments, and n-1 replies to proceed. Although both algorithms ensure mutual exclusion, the Ricart-Agrawala algorithm is more efficient in terms of message complexity, reducing the number of messages needed at the expense of potentially longer waiting times due to stricter conditions for entering the critical section.

Hierarchical deadlock detection mechanisms are effective for managing distributed systems with 100 sites because they balance the trade-offs between centralized and decentralized approaches. Hierarchical systems divide the network into regions where local deadlock detection can occur, reducing message overhead, while retaining the ability to aggregate and coordinate information at higher levels for global understanding. This approach improves scalability by limiting the span of direct communication, enhances fault tolerance due to regional independence, and eases complexity in managing deadlocks system-wide, making it suitable for large-scale distributed environments.

Resource deadlock occurs when processes wait indefinitely for resources held by one another, causing a standstill. Communication deadlock, on the other hand, happens in distributed systems when processes become unresponsive to each other's messages due to a cycle of waiting for messages within the network, leading to potential indefinite waiting periods without completion. The primary distinction lies in the nature of the waiting condition: while resource deadlock involves tangible resources like files or memory, communication deadlock involves the flow of messages within a network.

Token-based algorithms, such as Suzuki-Kasami or Raymond's tree-based method, ensure mutual exclusion by circulating a unique token among participants. This reduces message complexity since acquiring the token allows entry into the critical section. They provide no deadlock and inherent prevention of starvation, as opportunities are distributed fairly. Non-token-based algorithms rely on message passing for consensus on entering a critical section. While removing a single point of failure inherent in token systems, they usually have higher message complexities and require multiple communication rounds, impacting performance. Each type’s effectiveness depends on the network size and failure resilience needs.

The primary goals of implementing a Distributed File System (DFS) include providing location and replication transparency, ensuring fault tolerance, and enabling scalability. Location transparency allows users to access files without needing to know their physical storage location, while replication transparency ensures system reliability by maintaining multiple copies of files across nodes. Fault tolerance is achieved through redundancy and replication, allowing the system to withstand network issues or node failures. Scalability is essential to accommodate growing numbers of users, files, and nodes without performance degradation. Challenges in DFS implementation include maintaining data consistency across replicas, managing network communication overhead, and ensuring concurrent access control.

You might also like