Module 1 Notes
Module 1 Notes
MODULE-1
Introduction
OR
• There are many models and architectures of distributed systems in use today.
• Intranets: An intranet is a private network that is contained within an enterprise. It may consist
of many interlinked local area networks and also use leased lines in the Wide Area Network. It
separately administrated and enforces local security policies. It is connected to the Internet via a
router, It uses firewall to protect an
Intranet by preventing unauthorized messages leaving or entering, Some are isolated from the
Internet, Users in an intranet share data by means of file services.
• Client-server systems: The most traditional and simple type of distributed system, involves a
multitude of networked computers that interact with a central server for data storage, processing,
or other common goal.
• Cell phone networks: It is an advanced distributed system, sharing workloads among handsets,
switching systems, and internet-based devices.
Any Social Media can have its Centralized Computer Network as its Headquarters and computer
systems that can be accessed by any user and using their services will be the Autonomous Systems
in the Distributed System Architecture.
Distributed System Software: This Software enables computers to coordinate their activities and
to share the resources such as Hardware, Software, Data, etc.
Database: It is used to store the processed data that are processed by each Node/System of the
Distributed systems that are connected to the Centralized network.
Working-of-Distributed-System
As we can see that each Autonomous System has a common Application that can have its own
data that is shared by the Centralized Database System.
• Middleware Services enable some services which are not present in the local systems or
centralized system default by acting as an interface between the Centralized System and the local
systems. By using components of Middleware Services systems communicate and manage data.
• The Data which is been transferred through the database will be divided into segments or
modules and shared with Autonomous systems for processing.
• The Data will be processed and then will be transferred to the Centralized system through the
network and will be stored in the database.
1. Resource Sharing: It is the ability to use any Hardware, Software, or Data anywhere in the
System.
2. Openness: It is concerned with Extensions and improvements in the system (i.e., How openly
the software is developed and shared with others)
3. Concurrency: It is naturally present in Distributed Systems, that deal with the same activity or
functionality that can be performed by separate users who are in remote locations. Every local
system has its independent Operating Systems and Resources.
4. Scalability: It increases the scale of the system as a number of processors communicate with
more users by accommodating to improve the responsiveness of the system.
5. Fault tolerance: It cares about the reliability of the system if there is a failure in Hardware or
Software, the system continues to operate properly without degrading the performance the
system.
6. Transparency: It hides the complexity of the Distributed Systems to the Users and Application
programs as there should be privacy in every system.
• Resource Sharing (Autonomous systems can share resources from remote locations).
• It has extensibility so that systems can be extended in more remote locations and also
incremental growth.
• Security possess a problem due to easy access to data as the resources are shared to multiple
systems.
• Networking Saturation may cause a hurdle in data transfer i.e., if there is a lag in the network
then the user will face a problem accessing data.
• In comparison to a single user system, the database associated with distributed systems is much
more complex and challenging to manage.
• If every node in a distributed system tries to send data at once, the network may become
overloaded.
• Education: E-learning.
Resource sharing in distributed systems is very important for optimizing performance, reducing
redundancy, and enhancing collaboration across networked environments. By enabling multiple
users and applications to access and utilize shared resources such as data, storage, and computing
power, distributed systems improve efficiency and scalability.
Efficiency and Cost Savings: By sharing resources like storage, computing power, and data,
distributed systems maximize utilization and minimize waste, leading to significant cost
reductions.
Scalability: Distributed systems can easily scale by adding more nodes, which share the workload
and resources, ensuring the system can handle increased demand without a loss in performance.
Reliability and Redundancy: Resource sharing enhances system reliability and fault tolerance. If
one node fails, other nodes can take over, ensuring continuous operation.
Load Balancing: Efficient distribution of workloads across multiple nodes prevents any single node
from becoming a bottleneck, ensuring balanced performance and preventing overloads.
In distributed systems, resources are diverse and can be broadly categorized into several types:
Computational Resources: These include CPU cycles and processing power, which are shared
among multiple users and applications to perform various computations and processing tasks.
Storage Resources: Distributed storage systems allow data to be stored across multiple nodes,
ensuring data availability, redundancy, and efficient access.
Memory Resources: Memory can be distributed and shared across nodes, allowing applications
to utilize a larger pool of memory than what is available on a single machine.
Network Resources: These include bandwidth and network interfaces, which facilitate
communication and data transfer between nodes in a distributed system.
Data Resources: Shared databases, files, and data streams that are accessible by multiple users
and applications for reading and writing operations.
Peripheral Devices: Devices such as printers, scanners, and specialized hardware that can be
accessed remotely within the distributed network.
Client-Server Architecture:
A classic model where clients request services or resources from centralized servers. This
architecture centralizes resources and services, providing efficient access but potentially leading
to scalability and reliability challenges.
Use Cases: Web applications, databases, and enterprise systems where centralized control and
management are critical.
2. Peer-to-Peer (P2P) Networks: Distributed networks where each node can act as both a client
and a server. P2P networks facilitate direct resource sharing between nodes without reliance on
centralized servers, promoting decentralized and scalable resource access.
Distributed networks where each node can act as both a client and a server. P2P networks
facilitate direct resource sharing between nodes without reliance on centralized servers,
promoting decentralized and scalable resource access.
Use Cases: File sharing, content distribution networks (CDNs), and collaborative computing
environments.
3. Distributed File Systems: Storage systems that distribute files across multiple nodes, ensuring
redundancy and fault tolerance while allowing efficient access to shared data.
A Distributed File System (DFS) is a file system that is distributed on multiple file servers or
multiple locations. It allows programs to access or store isolated files as they do with the local
ones, allowing programmers to access files from any network or computer. In this article, we will
discuss everything about Distributed File System
Advantages: Distributes file storage across multiple nodes, providing redundancy, fault tolerance,
and efficient access to shared data.
Use Cases: Large-scale data storage and retrieval systems, such as Hadoop Distributed File System
(HDFS) for big data processing.
3. Load Balancing: Mechanisms that distribute workload across multiple nodes to optimize
resource usage and prevent overload on individual nodes, thereby improving performance and
scalability.
Load Balancer is defined as a networking device or software application that distributes and
balances the incoming traffic among the servers to provide high availability, efficient utilization of
servers, and high performance. A load balancer works as a “traffic cop” sitting in front of your
server and routing client requests across all servers. It simply distributes the set of requested
operations (database write requests, cache queries) effectively across multiple servers and
ensures that no single server bears too many requests.
4. Virtualization: Techniques such as virtual machines (VMs) and containers that abstract physical
resources, enabling efficient resource allocation and utilization across distributed environments.
A key idea in modern system design is virtualization, which provides a productive and adaptable
method of making use of hardware resources. Through the creation of virtualized versions of
physical components such as networks, storage, and servers, we can operate several separate
environments on a single physical machine or throughout a distributed system.
Advantages: easy to access, maintain, reduce component usage, avoid unnecessary error
accurance.
6. Caching: Storing frequently accessed data closer to users or applications to reduce latency and
improve responsiveness, enhancing overall system performance.
Caching is a system design concept that involves storing frequently accessed data in a location
that is easily and quickly accessible. The purpose of caching is to improve the performance and
efficiency of a system by reducing the amount of time it takes to access frequently accessed data.
Typically, web application stores data in a database. When a client requests some data, it is
fetched from the database and then it is returned to the user. Reading data from the database
needs network calls and I/O operation which is a time- consuming process. Cache reduces the
network call to the database and speeds up the performance of the system.
• Patterns of resource sharing vary widely in their scope and in how closely users work together:
• Search Engine: Users need no contact between users.
• Computer Supported Cooperative Working (CSCW): Users cooperate directly share resources.
Mechanisms to coordinate users' action are determined by the pattern of sharing and the
geographic distribution.
• For effective sharing, each resource must be managed by a program that offers a
communication interface enabling the resource to be accessed and updated reliably and
consistently
• An executing web browser is a client. It communicates with a web server to request web pages
from it.
• When a client invokes an operation upon the server, it is called the remote invocation.
• Resources may be encapsulated as objects and accessed by client objects. In this case a client
object invokes a method upon a server object.
• Key feature: Web provides a hypertext structure among the documents that it stores. The
documents contain links - references to other documents or resources. The structures of links can
be arbitrarily complex and the set of resources that can be added is unlimited.
i. HTML (Hypertext Makeup Language) specify the contents and layout of web pages.
ii. URL (Uniform Resource Location): identify a resource to let browser find it.
iii. HTTP (Hypertext Transfer Protocol) defines a standard rule by which browsers and any other
types of client interact with web servers.
• Consistency and Coherency: Ensuring that shared resources such as data or files remain
consistent across distributed nodes despite concurrent accesses and updates.
• Fault Tolerance: Ensuring resource availability and continuity of service in the event of node
failures or network partitions.
• Load Balancing: Distributing workload and resource usage evenly across distributed nodes to
prevent bottlenecks and optimize resource utilization.
• Security and Privacy: Safeguarding shared resources against unauthorized access, data
breaches, and ensuring privacy compliance.
Request-reply communication
Request-reply communication is synchronous because the client process blocks until the reply
arrives from the server. It can also be reliable because the reply from the server is effectively
an acknowledgement to the client.
Asynchronous request-reply communication is an alternative that may be useful in situations
where clients can afford to retrieve replies later.
1. Message Identifiers
• Purpose: Essential for managing messages to provide properties like reliable delivery or
request-reply communication. They allow unique referencing of each message.
2. Sender Identifier: A unique identifier for the sender process (e.g., its IP address
and port number).
• Uniqueness: The combination ensures the identifier is unique across the entire
distributed system.
• Sequence Wrap-around: When the requestId reaches its maximum value (e.g., 2³² - 1), it
resets to zero. A key assumption is that no message identifier is still in use by the time the
sequence numbers are reused.
2. Failure Model
• Underlying Protocol: If implemented over UDP, the request-reply primitives inherit UDP's
failure characteristics.
o No Ordering Guarantees: Messages are not guaranteed to arrive in the order they
were sent.
o Process Failures: Processes are assumed to have crash failures (they stop and do
nothing) rather than Byzantine failures (behaving arbitrarily).
• Simple Approach (Not Recommended): Return an immediate failure to the client upon
timeout. This is problematic because the operation might have been executed on the
server, but the reply was simply lost.
o It receives a reply, or
o It becomes clear the server is not responding (not just a lost message).
• Scenario: If a server receives a duplicate request (due to client retransmission) after it has
already sent the reply, it might execute the operation again.
• Idempotent Operations:
o Definition: An operation that can be performed multiple times with the exact
same effect as if it was performed once.
o Example: Adding an element to a set. Doing it once or multiple times results in the
same final state of the set.
o Non-Example: Appending an item to a list. Each execution will extend the list
further.
• What is a History? A data structure that stores records of reply messages that have
already been sent.
o Each entry contains: Request Identifier, Reply Message, and Client Identifier.
• Optimization: Since a client typically makes only one request at a time, a new request can
be interpreted as an acknowledgment for the previous reply. Therefore, a server often
only needs to keep the last reply sent to each client.
• Cleanup: History entries are discarded after a limited time to handle cases where a client
terminates without sending another request (which would have acted as an
acknowledgment).
• Remote Procedure Call (RPC): an abstraction that lets a program call a procedure on
another machine/process as if it were a local call.
• Introduced by Birrell & Nelson (1984); foundational for many distributed middleware
systems.
RPC systems provide stubs on client and server sides. The runtime and stubs handle network
details.
2. Client stub:
Before looking at the implementation of RPC systems, we look at three issues that are important
in understanding this concept:
• the key issue of transparency and how it relates to remote procedure calls.
Interfaces in distributed systems: In a distributed program, the modules can run in separate
processes. In the client-server model, in particular, each server provides a set of procedures that
are available for use by clients. For example, a file server would provide procedures for reading
and writing files. The term service interface is used to refer to the specification of the procedures
offered by a server, defining the types of the arguments of each of the procedures.
There are a number of benefits to programming with interfaces in distributed systems, stemming
from the important separation between interface and implementation:
• As with any form of modular programming, programmers are concerned only with the
abstraction offered by the service interface and need not be aware of implementation details.
• This approach provides natural support for software evolution in that implementations can
change as long as long as the interface (the external view) remains the same. More correctly, the
interface can also change as long as it remains compatible with the original.
RPC call semantics • Request-reply protocols were discussed in Section 5.2, where we showed
that doOperation can be implemented in different ways to provide different delivery guarantees.
The main choices are:
➢ Retry request message: Controls whether to retransmit the request message until
either a reply is received or the server is assumed to have failed.
➢ Duplicate filtering: Controls when retransmissions are used and whether to filter out
duplicate requests at the server.
Combinations of these choices lead to a variety of possible semantics for the reliability of
remote invocations as seen by the invoker. Note that for local procedure calls, the
semantics are exactly once, meaning that every procedure is executed exactly once
(except in the case of process failure). The choices of RPC invocation semantics are defined
as follows.
Maybe semantics: With maybe semantics, the remote procedure call may be executed
once or not at all. Maybe semantics arises when no fault-tolerance measures are applied
and can suffer from the following types of failure:
• crash failures when the server containing the remote operation fails.
If the result message has not been received after a timeout and there are no retries, it is
uncertain whether the procedure has been executed. If the request message was lost,
then the procedure will not have been executed. On the other hand, the procedure may
have been executed and the result message lost. A crash failure may occur either before
or after the procedure is executed. Moreover, in an asynchronous system, the result of
executing the procedure may arrive after the timeout. Maybe semantics is useful only for
applications in which occasional failed calls are acceptable.
• crash failures when the server containing the remote procedure fails;
• arbitrary failures – in cases when the request message is retransmitted, the remote
server may receive it and execute the procedure more than once, possibly causing wrong
values to be stored or returned.
At-most-once semantics: With at-most-once semantics, the caller receives either a result,
in which case the caller knows that the procedure was executed exactly once, or an
exception informing it that no result was received, in which case the procedure will have
• They both support programming with interfaces, with the resultant benefits that stem
from this approach.
• They are both typically constructed on top of request-reply protocols and can offer a
range of call semantics such as at-least-once and at-most-once.
• They both offer a similar level of transparency – that is, local and remote calls employ
the same syntax but remote interfaces typically expose the distributed nature of the
underlying call, for example by supporting remote exceptions.
RMI shares the same design issues as RPC in terms of programming with interfaces, call
semantics and level of transparency. The key added design issue relates to the object
model and, in particular, achieving the transition from objects to distributed objects. We
first describe the conventional, single-image object model and then describe the
distributed object model.
The object model: An object-oriented program, for example in Java or C++, consists of a
collection of interacting objects, each of which consists of a set of data and a set of
methods. An object communicates with other objects by invoking their methods,
generally passing arguments and receiving results. Objects can encapsulate their data and
the code of their methods.
Object references: Objects can be accessed via object references. For example, in Java, a
variable that appears to hold an object actually holds a reference to that object. To invoke
a method in an object, the object reference and method name are given, together with
any necessary arguments. The object whose method is invoked is sometimes called the
target and sometimes the receiver. Object references are first-class values, meaning that
they may, for example, be assigned to variables, passed as arguments and returned as
results of methods.
Exceptions: Programs can encounter many sorts of errors and unexpected conditions of
varying seriousness. During the execution of a method, many different problems may be
discovered: for example, inconsistent values in the object’s variables, or failures in
attempts to read or write to files or network sockets. When programmers need to insert
tests in their code to deal with all possible unusual or erroneous cases, this detracts from
the clarity of the normal case. Exceptions provide a clean way to deal with error conditions
without complicating the code. In addition, each method heading explicitly lists as
exceptions the error conditions it might encounter, allowing users of the method to deal
with them. A block of code may be defined to throw an exception whenever particular
unexpected conditions or errors arise. This means that control passes to another block of
code that catches the exception. Control does not return to the place where the exception
was thrown.
Implementation of RMI
Remote Method Invocation (RMI) enables an object in one process (client) to invoke
methods of an object in another process (server), as if it were local. Several components
work together to make this possible.
1. Communication Module
• Responsible for transferring request and reply messages between client and server.
• Implements the request-reply protocol.
• Contents of messages:
o Message type (request or reply)
o Request ID (unique ID for matching reply)
o Remote object reference (target object)
• Ensures the required invocation semantics (e.g., at-most-once).
• On the server side:
o Uses the request’s remote object reference to find the correct local object.
o Passes the request to the dispatcher.
This layer sits between the application objects and the communication modules.
(a) Proxy (Client Side)
• Acts as a local representative of the remote object.
• Responsibilities:
o Hides complexity of communication.
o Marshals arguments + operation ID + target reference → into request message.
o Sends message to server and waits for reply.
o Unmarshals results and returns them to the client.
• Each remote object has one proxy per client process.
• Makes invocation transparent (client sees it like a normal method call).
6. Dynamic Invocation
8. Factory Methods
1. Tracking Holders
• Each server process keeps track of which clients are holding references to its remote
objects.
• For object B, the server maintains B.holders → a set of clients that have a proxy for B.
• This info is stored in the remote object table.
2. Adding a Reference
3. Removing a Reference
• When client C’s garbage collector sees that proxy B is no longer needed:
1. Client sends removeRef(B) to the server.
2. Server removes C from B.holders.
3. Client deletes its proxy.