Unit 3 Introduction To Distributed Systems
Unit 3 Introduction To Distributed Systems
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
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.
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.
To Transfer the Data to Autonomous Systems, Centralized System should be
having a Middleware Service and should be connected to a Network.
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.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
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.
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.
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.
Transparency: It hides the complexity of the Distributed Systems to the Users and
Application programs as there should be privacy in every system.
Heterogeneity: Networks, computer hardware, operating systems, programming
languages, and developer implementations can all vary and differ among dispersed
system components.
Advantages of Distributed System:
Applications in Distributed Systems are Inherently Distributed Applications.
Information in Distributed Systems is shared among geographically
distributed users.
Resource Sharing (Autonomous systems can share resources from remote
locations).
It has a better price performance ratio and flexibility.
It has shorter response time and higher throughput.
It has higher reliability and availability against component failure.
It has extensibility so that systems can be extended in more remote locations
and also incremental growth.
Disadvantages of Distributed System:
Relevant Software for Distributed systems does not exist currently.
Security possesses 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.
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.
Applications Area of Distributed System:
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Networks of computers are everywhere. The Internet is one, as are the many
networks of which it is composed. Mobile phone networks, corporate networks,
factory networks, campus networks, home networks, in-car networks – all of these,
both separately and in combination, share the essential characteristics that make
them relevant subjects for study under the heading distributed systems.
Computers that are connected by a network may be spatially separated by any
distance. They may be on separate continents, in the same building or in the same
room. Our definition of distributed systems has the following significant
consequences:
Concurrency: In a network of computers, concurrent program execution is the norm. I
can do my work on my computer while you do your work on yours, sharing
resources such as web pages or files when necessary. The capacity of the system to
handle shared resources can be increased by adding more resources (for example.
computers) to the network. We will describe ways in which this extra capacity can be
usefully deployed at many points in this book. The coordination of concurrently
executing programs that share resources is also an important and recurring topic.
No global clock: When programs need to cooperate they coordinate their actions by
exchanging messages. Close coordination often depends on a shared idea of the time
at which the programs’ actions occur. But it turns out that there are limits to the
accuracy with which the computers in a network can synchronize their clocks – there
is no single global notion of the correct time. This is a direct consequence of the fact
that the only communication is by sending messages through a network.
Independent failures: All computer systems can fail, and it is the responsibility of
system designers to plan for the consequences of possible failures. Distributed systems
can fail in new ways. Faults in the network result in the isolation of the computers that
are connected to it, but that doesn’t mean that they stop running. In fact, the programs
on them may not be able to detect whether the network has failed or has become
unusually slow. Similarly, the failure of a computer, or the unexpected termination of
a program somewhere in the system (a crash), is not immediately made known to the
other components with which it communicates. Each component of the system can fail
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
independently, leaving the others still running. The consequences of this characteristic
of distributed systems will be a recurring theme throughout the book.
The key challenges faced by the designers of distributed systems: heterogeneity,
openness, security, scalability, failure handling, concurrency, transparency and
quality of service.
Challenges
In this section we describe the main challenges.
Heterogeneity
The Internet enables users to access services and run applications over a
heterogeneous collection of computers and networks. Heterogeneity (that is, variety
and difference) applies to all of the following:
• networks;
• computer hardware;
• operating systems;
• programming languages;
• implementations by different developers.
Middleware • The term middleware applies to a software layer that provides a
programming abstraction as well as masking the heterogeneity of the underlying
networks, hardware, operating systems and programming languages. The Common
Object Request Broker (CORBA) is an example. Some middleware, such as Java
Remote Method Invocation (RMI), supports only a single programming language.
Most middleware is implemented over the Internet protocols, which themselves
mask the differences of the underlying networks, but all middleware deals with the
differences in operating systems and hardware.
Heterogeneity and mobile code • The term mobile code is used to refer to program code
that can be transferred from one computer to another and run at the destination –
Java applets are an example. Code suitable for running on one computer is not
necessarily suitable for running on another because executable programs are
normally specific both to the instruction set and to the host operating system.
Openness
The openness of a computer system is the characteristic that determines whether the
system can be extended and re-implemented in various ways. The openness of
distributed systems is determined primarily by the degree to which new resource-
sharing services can be added and be made available for use by a variety of client
programs.
To summarize:
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
• Open systems are characterized by the fact that their key interfaces are
published.
• Open distributed systems are based on the provision of a uniform
communication mechanism and published interfaces for access to shared
resources.
• Open distributed systems can be constructed from heterogeneous hardware
and software, possibly from different vendors. But the conformance of each
component to the published standard must be carefully tested and verified if
the system is to work correctly.
Security
Many of the information resources that are made available and maintained in
distributed systems have a high intrinsic value to their users. Their security is
therefore of considerable importance. Security for information resources has three
components: confidentiality (protection against disclosure to unauthorized
individuals), integrity (protection against alteration or corruption), and availability
(protection against interference with the means to access the resources).
In a distributed system, clients send requests to access data managed by servers,
which involves sending information in messages over a network. For example:
A doctor might request access to hospital patient data or send additions to that
data.
In electronic commerce and banking, users send their credit card numbers
across the Internet.
In both examples, the challenge is to send sensitive information in a message over a
network in a secure manner. But security is not just a matter of concealing the
contents of messages – it also involves knowing for sure the identity of the user or
other agent on whose behalf a message was sent. In the first example, the server
needs to know that the user is really a doctor, and in the second example, the user needs
to be sure of the identity of the shop or bank with which they are dealing. The second
challenge here is to identify a remote user or other agent correctly. Both of these
challenges can be met by the use of encryption techniques developed for this
purpose.
However, the following two security challenges have not yet been fully met:
Denial of service attacks
Security of mobile code
Scalability
Distributed systems operate effectively and efficiently at many different scales,
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
server in the Internet. The challenge is to manage in the presence of failures that
cannot be detected but may be suspected.
Masking failures: Some failures that have been detected can be hidden or made less
severe. Two examples of hiding failures:
1. Messages can be retransmitted when they fail to arrive.
2. File data can be written to a pair of disks so that if one is corrupted, the
other may still be correct.
Tolerating failures: Most of the services in the Internet do exhibit failures – it would
not be practical for them to attempt to detect and hide all of the failures that might
occur in such a large network with so many components. Their clients can be
designed to tolerate failures, which generally involves the users tolerating them as
well. For example, when a web browser cannot contact a web server, it does not make
the user wait forever while it keeps on trying – it informs the user about the problem,
leaving them free to try again later. Services that tolerate failures are discussed in the
paragraph on redundancy below.
Recovery from failures: Recovery involves the design of software so that the state of
permanent data can be recovered or ‘rolled back’ after a server has crashed. In
general, the computations performed by some programs will be incomplete when a
fault occurs, and the permanent data that they update (files and other material stored
in permanent storage) may not be in a consistent state.
Redundancy: Services can be made to tolerate failures by the use of redundant
components. The design of effective techniques for keeping replicas of rapidly
changing data up- to-date without excessive loss of performance is a challenge.
Distributed systems provide a high degree of availability in the face of hardware
faults. The availability of a system is a measure of the proportion of time that it is
available for use. When one of the components in a distributed system fails, only the
work that was using the failed component is affected. A user may move to another
computer if the one that they were using fails; a server process can be started on
another computer.
Concurrency
Both services and applications provide resources that can be shared by clients in a
distributed system. There is therefore a possibility that several clients will attempt
to access a shared resource at the same time.
Transparency
Transparency is defined as the concealment from the user and the application
programmer of the separation of components in a distributed system, so that the
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
DSM is a mechanism that manages memory across multiple nodes and makes inter-
process communications transparent to end-users. The applications will think that
they are running on shared memory. DSM is a mechanism of allowing user
processes to access shared data without using inter-process communications. In
DSM every node has its own memory and provides memory read and writes
services and it provides consistency protocols. The distributed shared memory
(DSM) implements the shared memory model in distributed systems but it doesn’t
have physical shared memory. All the nodes share the virtual address space
provided by the shared memory model. The Data moves between the main
memories of different nodes.
On-Chip Memory:
The data is present in the CPU portion of the chip.
Memory is directly connected to address lines.
On-Chip Memory DSM is expensive and complex.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Bus-Based Multiprocessors:
A set of parallel wires called a bus acts as a connection between CPU and
memory.
accessing of same memory simultaneously by multiple CPUs is prevented by
using some algorithms
Cache memory is used to reduce network traffic.
Ring-Based Multiprocessors:
There is no global centralized memory present in Ring-based DSM.
All nodes are connected via a token passing ring.
In ring-bases DSM a single address line is divided into the shared area.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
3. Hybrids
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
space.
Here the processes need to ensure that It is useful for sharing small
5. they are not writing to the same amounts of data as conflicts need
location simultaneously. not to be resolved.
Relatively slower
6. Faster communication strategy.
communication strategy.
Example- Example-
Data from a client process may Web browsers
9.
need to be transferred to a server Web Servers
process for modification before Chat program on WWW
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
In their simplest form, the prototypes of these operations are defined as follows:
•Process P0 sends a message to process P1which receives and prints the message.
• The important thing to note is that process P0 changes the value of a to 0
immediately following the send.
•The semantics of the send operation require that the value received by process
P1must be 100 (not 0).
•That is, the value of a at the time of the send operation must be the value that is
received by processP1.
•It may seem that it is quite straight forward to ensure the semantics of the send and
receive operations.
•However, based on how the send and receive operations are implemented this may
not be the case.
•Most message passing platforms have additional hardware support for sending and
receiving messages.
•They may support DMA (direct memory access) and asynchronous message transfer
using network interface hardware.
•Network interfaces allow the transfer of messages from buffer memory to desired
location without CPU intervention.
•Similarly, DMA allows copying of data from one memory location to another (e.g.,
communication buffers) without CPU support (once they have been programmed).
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
•As a result, if the send operation programs the communication hardware and returns
before the communication operation has been accomplished, process P1 might
receive the value 0 in a instead of 100!
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
•The code fragment makes the values of a available to both processes P0 and P1.
•However, if the send and receive operations are implemented using a blocking non-
buffered protocol,
The send at P0 waits for the matching receive at P1
whereas the send at process P1waits for the corresponding receive at
P0 ,
resulting in an infinite wait.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
• Deadlocks are very easy in blocking protocols and care must be taken to
break cyclic waits.
•Note that at the receiving end, the data cannot be stored directly at the target
location since this would violate program semantics.
•Instead, the data is copied into a buffer at the receiver as well.
•When the receiving process encounters a receive operation, it checks to see if the
message is available in its receive buffer. If so, the data is copied into the target
location.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
In Fig.2 Left, buffers are used at both sender and receiver and communication is
handled by dedicated hardware.
•Sometimes machines do not have such communication hardware.
•In this case, some of the overhead can be saved by buffering only on one side.
•For example, on encountering a send operation, the sender interrupts the receiver,
both processes participate in a communication operation and the message is
deposited in a buffer at the receiver end.
•When the receiver eventually encounters a receive operation, the message is copied
from the buffer into the target location.
•In general, if the parallel program is highly synchronous, non-buffered sends may
perform better than buffered sends.
•However, generally, this is not the case and buffered sends are desirable unless
buffer capacity becomes an issue.
•Impact of finite buffers in message passing; consider the following code fragment:
•In this code fragment, process P0 produces 1000 data items and process P1 consumes
them.
•However, if process P1 was slow getting to this loop, process P0 might have sent all
of its data.
•If there is enough buffer space, then both processes can proceed;
•However, if the buffer is not sufficient (i.e., buffer overflow), the sender would have
to be blocked until some of the corresponding receive operations had been posted,
thus freeing up buffer space.
•This can often lead to unforeseen overheads and performance degradation.
•In general, it is a good idea to write programs that have bounded buffer
requirements.
•Dead locks in Buffered Send and Receive Operations:
•While buffering relieves many of the deadlock situations, it is still possible to write
code that deadlocks.
•This is due to the fact that as in the non-buffered case, receive calls are always
blocking (to ensure semantic consistency).
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
•Thus, a simple code fragment such as the following deadlocks since both processes
wait to receive data but nobody sends it.
•Once again, such circular waits have to be broken.
•However, deadlocks are caused only by waits on receive operations in this case.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
•Comparing Figures 3Left and 1a, it is easy to see that the idling time when the
process is waiting for the corresponding receive in a blocking operation can now be
utilized for computation (provided it does not update the data being sent).
•This removes the major bottleneck associated with the former at the expense of
some program restructuring.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
with abstraction. This abstraction is to hide the message passing so that the
communication looks like a normal procedure call. Group communication also helps
the processes from different hosts to work together and perform operations in a
synchronized manner, therefore increasing the overall performance of the system.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
It is based on the client-server concept. The client is the program that makes the
request, and the server is the program that gives the service. An RPC, like a local
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
procedure call, is based on the synchronous operation that requires the requesting
application to be stopped until the remote process returns its results. Multiple
RPCs can be executed concurrently by utilizing lightweight processes or threads
that share the same address space. Remote Procedure Call program as often as
possible utilizes the Interface Definition Language (IDL), a determination
language for describing a computer program component’s Application
Programming Interface (API). In this circumstance, IDL acts as an interface
between machines at either end of the connection, which may be running
different operating systems and programming languages.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
RPC for Broadcast: A client’s request that is broadcast all through the network and
handled by all servers that possess the method for handling that request is known as a
broadcast RPC. Broadcast RPC’s features include:
You have an option of selecting whether or not the client’s request message
ought to be broadcast.
It also gives you the option of declaring broadcast ports.
It helps in diminishing physical network load.
Batch-mode RPC: Batch-mode RPC enables the client to line and separate RPC
inquiries in a transmission buffer before sending them to the server in a single batch
over the network. Batch-mode RPC’s features include:
It diminishes the overhead of requesting the server by sending them all at
once using the network.
It is used for applications that require low call rates.
It necessitates the use of a reliable transmission protocol.
Local Procedure Call Vs Remote Procedure Call:
Remote Procedure Calls have disjoint address space i.e. different address
space, unlike Local Procedure Calls.
Remote Procedure Calls are more prone to failures due to possible processor
failure or communication issues of a network than Local Procedure Calls.
Because of the communication network, remote procedure calls take longer
than local procedure calls.
Advantages of Remote Procedure Calls
The technique of using procedure calls in RPC permits high-level languages
to provide communication between clients and servers.
This method is like a local procedure call but with the difference that the
called procedure is executed on another process and a different computer.
The thread-oriented model is also supported by RPC in addition to the
process model.
The RPC mechanism is employed to conceal the core message passing
method.
The amount of time and effort required to rewrite and develop the code is
minimal.
The distributed and local environments can both benefit from remote
procedure calls.
To increase performance, it omits several of the protocol layers.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Abstraction is provided via RPC. To exemplify, the user is not known about
the nature of message-passing in network communication.
RPC empowers the utilization of applications in a distributed environment.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.
[Unit III - INTRODUCTION TO DISTRIBUTED SYSTEMS]
At the server side, the packed parameters are unbundled and then the required
method is invoked. This process is known as unmarshalling.
RMI Registry
RMI registry is a namespace on which all server objects are placed. Each time the
server creates an object, it registers this object with the RMI registry
(using bind() or reBind() methods). These are registered using a unique name
known as bind name.
To invoke a remote object, the client needs a reference of that object. At that time,
the client fetches the object from the registry using its bind name
(using lookup() method).
The following illustration explains the entire process −
Goals of RMI
Following are the goals of RMI −
To minimize the complexity of the application.
To preserve type safety.
Distributed garbage collection.
Minimize the difference between working with local and remote objects.
Prepared By: Dr. K. Suresh, Assistant Professor / CSE Department, KPRIET, Coimbatore.