Вы находитесь на странице: 1из 83

Distributed

system

Definition
A distributed system is a collection of indepent
entities that cooperate to solve problem that
cannot be individually solved
processor
memory

Message passing
Message passing
processor

processor

memory

memory

Message passing

The characterized of distributed


system
1. You must know that when the one of computers in
distributed system is crash the distributed its
never heard and its continue his work
2. A collection of computers that do not share
common memory that communicate by messages
passing over communication
network and where each computer
has its own memory and runs its own operating
system typically the computers are semiautonomous and loosely coupled while they
cooperate to address problem
3. A collection of independent computers that appears

4- A term that describes a wide range of


computers from weakly coupled system such as
wide area network(WAN) to strongly coupled
systems such as local area network (LAN) to very
strongly coupled system such as multiprocessor
system

Characterized distributed system


over communication network
1. No common physical clock
This is an important assumption
because it introduces the element
of distributed in the system and
gives rise to the inherent a
synchrony( ) Between the
processors

2. No shared memory
This is a key feature that requires message
passing for communication this feature
implies( )the absence()
Of the common physical clock

3. Geographical separation
Its not necessary for the processors to be on a
wide area network(WAN) recently the
Network/cluster of work station(NOW/COW)
configuration connecting processor on LAN
The NOW configuration is becoming popular
because of the low-cost and high speed. The
google search engine based on the NOW
architecture

4. Autonomy and
heterogeneity
The processors are loosely coupled in that they
have different speeds and each can be running a
different operating system but they cooperate
with another by offering services or solving a
problem

The motivation for using


distributed system
1. Inherently distributed computations
()
In many applications such as money transfer in banking, that
reach consensus( )among parties( ) that are
geographically distant.

2. Resource sharing()
Resources such as peripherals, complete data sets in
databases, special libraries, as well as data (variable/files)
cannot be fully replicated at all the sites because it is often
neither practical Therefore, such resources are typically
distributed across the system. For example, distributed
databases such as DB2 partition the data sets across several
servers in addition to replicating them at a few sites

3. Access to geographically
remote data and resources
(
)
In many scenarios, the data cannot be replicated
at every site participating in the distributed
execution because it may be too large or too
sensitive to be replicated. For example, payroll
data within a multinational corporation is both too
large and too sensitive to be replicated at every
branch office/site. It is therefore stored at a
central server which can be queried by branch
offices. Similarly, special resources such as
supercomputers exist only in certain()
locations, and to access such supercomputers,

4. Enhanced reliability()
A distributed system has the inherent
potential( ) to provide increased
reliability because of the possibility of replicating
resources and executions, as well as ( ) the
reality that geographically distributed resources
are not likely to crash/malfunction( ) at
the same time under normal circumstances.
Reliability entails several aspects:
Availability: the resource should be accessible at
all times;
integrity: the value/state of the resource should
be correct
fault-tolerance:the ability to recover from
system failures
When the system meet one of the failure model

5. Increased performance/cost
ratio
(( /
By resource sharing and accessing geographically
remote data and resources, the performance/cost
ratio is increased. Although higher throughput has
not necessarily been the main objective behind
using a distributed system any task can be
partitioned across the various computers in the
distributed system

6. Scalability()
As the processors are usually connected by a
wide-area net- work, adding more processors does
not effected for the communication network.

7. Modularity and
incremental
expandability(
)
Heterogeneous processors may be easily added
into the system without affecting the
performance, as long as those processors are
running the same middleware algo- rithms.
Similarly, existing processors may be easily
replaced by other processors.

Types of Multiprocessors
There are two types of multiprocessors on the
way their memory is organized.
1.Tightly coupled multiprocessors.
2.loosely coupled multiprocessors.

Tightly coupled multiprocessors


1. Tightly coupled multiprocessors

Tightly coupled multiprocessors


In tightly coupled main memory is shared by
all processors i.e. HIGH DEGREE OF
RESOURCE SHARING.
This is used to speed up the execution of a
single large program in time critical
operations.
all processors share main memory &access to
I/O devices and are interconnected by a bus.
It is characterized by uniform memory access
time.

Loosely coupled multiprocessors


2.Loosely coupled multiprocessors

Loosely coupled multiprocessors


In loosely coupled multiprocessor each processor
has its own memory (i.e. faster access to its local
or own memory).
processor interact through interconnection
structure or by message passing using standard
primitive functions send() & receive().
The access to remote memory attached to other
processors takes longer time due to added delay
through the interconnection network.
It is characterized by non-uniform memory access
time.

DIFFERNCE BETWEEN TIGHTLY


AND LOOSELY COUPLED
MULTIPROCESSOR

1)Tightly coupled
Multiprocessor
systemscontain
multiple CPUs that are
connected at the bus
level. These CPUs
mayhave access to a
central shared memory
or may
participate( )in a
memory hierarchy with
both local and shared
memory (NUMA).

1)Looselycoupledmultiproce
ssor system(often
referred to as
clusters) are
basedon multiple
standalone()
single or dual
process or
interconnected
viaa high speed
communication

2) Tightly-coupled
(2) Loosely coupled
systems perform
system is just
better & are
Opposite of tightly
physically smaller
coupled system.
than loosely-coupled 3) Less expensive.
system
(4)In a loosely3) More expensive.
coupled system,
4) In a tightly-coupled
the opposite is
system, the delay
true: The interExperienced , when a machine message
message is sent from delay is large and
one computer to
the data rate is
another is short and
low.
data rate is high;
that is, the number

DIFFERNCE BETWEEN TIGHTLY


AND LOOSELY COUPLED
MULTIPROCESSOR

5) For example,
two CPU chips on
the same printed
circuit board and
connected by
wire etched onto
the board are
likely to be
tightly Coupled.

5) For example two


computers
connected by
a2400 bit/sec
modem over the
telephone system
are certain tobe
loosely coupled.

Relation to parallel
multiprocessor/multicomputer
systems
The main question is the system still a distributed
system, or does it become a parallel
multiprocessor system? To better answer these
questions, we first examine the architecture of
parallel systems

Characteristics of parallel
systems
A parallel system may be classified as belonging
to one of three types:
1. A multiprocessor system: is a parallel system in
which the multiple processors have direct access to
shared memory which forms a common address space.
The architecture is shown in the following Figure . Such
processors usually do not have a common clock.
pc1

pc2

pc3

Shared
memor
y

Characteristics of parallel
systems
A multiprocessor system usually corresponds
()to a uniform memory access (UMA)
architecture in which the access latency, waiting
time, to complete an access to any memory
location from any processor is the same.
The processors are in very close physical
proximity and are connected by an
interconnection network
The communication across processors is
traditionally through read and write operations on
the shared memory
the processors usually run the same operating
system, and both the hardware and software are
very tightly coupled.

Characteristics of parallel
systems
Examples of multiprocessor system
Omega network and butterfly(banyan)
network :
each of which is a multi-stage network formed of
2 2 switching elements. Each 2 2 switch
allows data on either of the two input wires to be
switched to the upper or the lower
output wire. In a single step, however, only one
data unit can be sent on an output wire. So if the
data from both the input wires is to be routed to
the same output wire in a single step, there is a
collision
Each 2 2 switch is represented as a rectangle in
the following figure

Characteristics of parallel
systems

Characteristics of parallel
systems
2. A multicomputer parallel system: Is a parallel
system in which the multiple processors do not
have direct access to shared memory. The
memory of the multiple processors may or may
not form a common address space
The processors are in close physical proximity and
are usually very tightly coupled (homogenous
hardware and software), and connected by an
interconnection network. Such computers usually
do not have a common clock
A multicomputer system that has a common
address space usually corresponds to a nonuniform memory access (NUMA) architecture in
which the latency to access various shared
memory locations from the different processors

Characteristics of parallel
systems
Examples of multicomputer system
Wrap-around 2D-mesh(torus) and Hypercube :
For a k k mesh which
will contain k2 processors, the maximum path
length between any two processors is 2(k/2 1).
While A k-dimensional hyper- cube has 2k
processor-and-memory units . Each such unit is a
node
in the hypercube, and has a unique k-bit label.
Each of the k dimensions is associated with a bit
position in the label. The labels of any two
adjacent( )nodes are identical( )except
for the bit position corresponding to the
dimension in which the two nodes differ.

Characteristics of parallel
systems

Characteristics of parallel
systems
3. Array processors: Belong to a class of parallel
computers that are physically very tightly
coupled, and have a common system clock (but
may not share memory and communicate by
passing data using messages).
The primary and most effective use of parallel
systems is for obtaining a higher throughput by
dividing the computational workload among the
processors. The tasks that are most
amenable( ) to higher speedups on
parallel systems

Flynns taxonomy
Flynn identified four processing
modes, based on whether the
processors execute the same or
different instruction streams at the
same time, and whether or not the
processors processed the same
(identical) data at the same time

Single instruction stream, single data


stream (SISD)
This mode corresponds to the conventional
processing in the von Neumann paradigm with a
single CPU, and a single memory unit connected
by a system bus
Single instruction stream, multiple data
stream (SIMD)
This mode corresponds to the processing by
multiple homogenous processors which execute in
lock-step on different data items
Multiple instruction stream, single data
stream (MISD)
This mode corresponds to the execution of

Multiple instruction stream, multiple data


stream (MIMD)
In this mode, the various processors execute
different code on different data. This is the mode
of operation in distributed systems as well as in
the vast majority( ) of parallel
systems. There is no common clock among the
system processors
. MIMD architectures are most general and allow
much flexibility in partitioning code and data to be
processed among the processors

OSI
Open Systems
Interconnect

Rapid growth of computer


networks caused compatibility
problems
ISO recognized the problem and
released the OSI model in 1984
OSI stands for Open Systems
Interconnection and consists of 7
Layers
The use of layers is designed to
reduce complexity and make
standardization easier

The 7-layers
7. Application
6. Presentation
5. Session
4. Transport
3. Network
2. Data Link
1. Physical

Mnemonics
7.) (A)pplication

(A)ll

6.) (P)resentation

(P)eople

5.) (S)ession

(S)eem

4.) (T)ransport

(T)O

3.) (N)etwork

(N)eed

2.) (D)ata Link

(D)ata

1.) (P)hysical

(P)rocessing

Division of Layers
7. Application
6. Presentation
Upper Layers
5. Session
4. Transport

Middle Layer

3. Network
2. Data Link
1. Physical

Lower Layers

The first three layer which called upper layers it is


specified
For user application and programming
The middle layer it is work as interface between
upper layer and lower layer
While the lower layer it is specified for bit transfer
from data and swap it between networks

The Role of Layers in


Point-to-point
Communication
Node a
E

7. Application N

1. Physical

C
A
P
S
U
L
A
T
I
O

Node b

7. Application

1.Physical

D
E
E
N
C
A
P
S
U
L
A
T
I
O
n

7-layers
Application layer:
In this layer the user will control on it directly
The Purpose of using this layer it is convert
User application to network service interface
Example E-mail services
Presentation Layer:
This layer response for Data formatting and
give it to the next layer in suitable way
The purpose of this layer is to formats data for
exchange between points of communication
Ex: Between nodes in a network

7-layers
Session Layer:
Sometimes called the dialog controller, this
layer establishes, maintains, and terminates
sessions between applications
This layer is response for define the devices
and its name and gives repot about the
connection
In this layer defines checkpoints for
acknowledgements during sessions between
applications

7-layers
Transport Layer:
in this layer the data will separate into
segments and it is Repackage proper(
)and efficient delivery of packages the
package should be

Without error
In sequence
Without duplication

7-layers
Network layer:
It is responsible to address messages and
translate the logical address to the physical
address that the network understand it

Ex: nganesa ----------> 102.13.345.25

In this layer it choice Best path at the time of


transmission
So the routers its work here

7-layers
Data Link Layer:
The purpose of this layer is Manages the flow of
data over the physical media and its responsible
for error-free transmission over the physical media
In this layer the data will be separate into smaller
parts called Frame
in this layer two parts will add into data first one
called Header the second one is called Trailer

header

Data

Trailer

7-layers
Physical Layer:
Purpose deals with the transmission of 0s and 1s
over the physical media
Translation of bits into signals

Computer Networks
LAN ,WAN
WAN

LAN

Wide Area Network

Local Area Network

Large geographic
areas (e.g., cities,
states, nations)

Local areas only


(e.g., homes,
offices, schools)

WAN (Wide Area


Network) is a
computer network
that covers a broad
area (e.g., any
network whose
communications
links cross
metropolitan,
regional, or national
boundaries over a
.long distance)

LAN (Local Area


Network) is a
computer network
covering a small
geographic area,
like a home, office,
school, or group of
.buildings

Stands For
Covers

Definition

Computer Networks
LAN ,WAN
WANs have a lower
data transfer rate
.compared to LANs

LANs have a high


.data transfer rate

Data transfer
rates

The Internet is a
good example of a
WAN

The network in an
office building can
be a LAN

Example

Computers
connected to a
wide-area network
are often connected
through public
networks, They can
also be connected
through leased lines
.or satellites

One LAN can be


connected to other
LANs over any
distance via
telephone lines

Layers 3 devices
Routers, Multi-layer
Switches

Layer 2 devices like


switches and
bridges. Layer 1

Connection

Components

Computer Networks
LAN ,WAN
WANs tend to be
less fault tolerant as
they consist of large
.number of systems

LANs tend to have


fewer problems
associated with
them, as there are
smaller number of
systems to deal
.with

Experiences more
data transmission
errors as compared
to LAN

Experiences fewer
data transmission
errors

WANs (like the


Internet) are not
owned by any one
organization

Typically owned,
controlled, and
managed by a
single person or
.organization

For WANs since


networks in remote

If there is a need to
set-up a couple of

Fault Tolerance

Data
Transmission
Error

Ownership

Set-up costs

Computer Networks
LAN ,WAN
Have a large
geographical range
generally spreading
across boundaries
and need leased
telecommunication
lines

Have a small
geographical range
and do not need
any leased
telecommunication
lines

Maintaining WAN is
difficult because of
its wider
geographical
coverage and
higher maintenance
.costs

Because it covers a
relatively small
geographical area,
LAN is easier to
maintain at
.relatively low costs

Low bandwidth is
available for
.transmission

High bandwidth is
available for
.transmission

More congestion

Less congestion

Geographical
Spread

Maintenance
costs

Bandwidth
)Congestion)

Ethernet
Ethernet is a certain type of a local area network (LAN)
which was developed in 1972 in the renowned
PARC-research facility of Xerox in Palo Alto by
Robert Metcalfe. In the meantime the companies
Intel, DEC and Xerox have specified a common
standard that has been established in the IEEEstandard 802.3.

Medium

Medium

Medium

Ethernet Technologies:
10Base2
Thin coaxial cable in a bus topology

10BaseT and 100BaseT


10/100 Mbps rate
T stands for Twisted Pair
Hub(s) connected by twisted pair facilitate
star topology
Distance of any node to hub must be < 100M

Collision

CSMA/CD

Collision

Access method:
CSMA/CD

Back-Off Algorithm
If a collision has occurred, the stations
try to send again after a certain period
of time.
After the first collision there a two
different back-off times available, from
which one is chosen at random.
Transmission probability is 50%
After the second consecutive collision
there are four different back-off times
available, from which one is chosen at
random.
The transmission probability now is 75%

Segmentation


Segmentation


Segmentation

Client server model


Server: Is a process implementing specific
service
For example database service
Client: Is a process that request service from a
server by sending it request and subsequently
waiting for servers replay
This known client server interaction also known
Request- reply behavior
The communication between a client and a server
can be implemented by means of simple
connectionless protocol

Request reply behavior


Client

waiting for
result
Request

Server

Reply

provide
Time
service

When a client request a service ,it simply packages


a massage to the server , identifying the service it

Request reply behavior


The massage is then send to the server.
After the massage is sent the client get
suspend until it get reply
The server now is weak up and provide
service , its work on the data and then send
reply to the client
After sent replay the server will be free to get
more request
And the client get resume and continue its
work

Request reply behavior


Using connectionless protocol has the
advantage of being efficient as long as messages
do not get lost or corrupted
Making the protocol resistant to occasional
transmission failures is not trivial
The only thing we can do is possibly let the client
resend the request when no reply message comes
in.
The problem is that the client cannot detect
whether the original request message was lost or
that transmission of the reply failed
If the reply lost then resending a request may
result in performance the operation twice
Example if operation was something like

As the alternative many client server systems


use a reliable connection oriented protocol .
Although this solution is not appropriate in local
area network because it give low performance
but its works perfectly fine on the wide area
network
Reliable connection oriented protocol: when a
client request service it first sets up a connection
to the sever before sending a request . The sever
use same connection to send the reply massage .
After that the connection get down

Client Server
Architectures
The client server can be organize in two type of
machine
1. A client machine containing only the programs
that implementing on the user interface level
2. A server machine containing the rest that is the
programs implementing the processing and
data level
The problem with this organization is not
really distributed
Everything is handled by the server, while
the client is no more than a dumb terminal

three tiered architecture

User interface

wait for result


(presentation)

REQUEST
operation
Application

Request
server

data

Database server

Return result
wait for data
Return
data

At first time the client that in user interface level will send request to the
sever to get the result
After sending request the client get suspend until the result get back
When the request reach to the Application server the server get resume

three tiered architecture


The server continue its work with processing
level suppose the request needed some data to
perform
Now the server will send data request for the data
level and get suspend until the data reach
The database level will send the data to
processing level and the server continue its work
After performing the request it will be sent to
client and the client get resume and continue its
work .

Remote Procedure Call


Remote Procedure Call (RPC) is aprotocol
that one program can use to request a
service from a program located in another
computer in a network without having to
understand network details.
(Aprocedure callis also sometimes known as
afunction callor asubroutine call.) RPC uses
theclient/servermodel.
The requesting program is a client and the
service-providing program is the server

RPC b/w client and server


Client

waiting for result

Call remote
Procedure

Server
time

Return
from call
Call local procedure
and return result

Client and Server Stubs


Suppose that a program needs to read some data
from a file. The programmer puts a call to read in
the code to get the data in the traditional (singleprocessor) system.
The read routine is extracted from the library by
the linker and inserted into the object program .
After the programmer calling procedure then
mean put the parameter in a stack
All the above procedures its controlled by client
stube
Its pass a parameter into message & send
it to the server

Client and Server Stubs


When the message arrives at the server, The
server operating system pass message into
server stub.
server stube its a piece of code that transforms
request coming over the network into local
procedure calls
The server performs its work and returns the
result to the caller in usual way
When the message gets back to the client
machine the clients OS sees the address of the
client and then the message puts into waiting
buffer and client process unblocked.

Client and Server Stubs

Asynchronous RPC
When a client calls a remote procedure the client will
block until a reply is returned this request-reply
behavior is unnecessary when there is no result to
return and only leads to blocking the client while it
could have proceeded and have done useful work
To support such situations,RPC system provide
facilities that called asynchronous RPCs by which
client immediately continues after issuing the
RPC request . With asynchronous RPCs the
server immediately sends a reply back to the
client the moment the RPC request is received
The reply acts as an acknowledgement to the
client
The client will continue without blocking as
soon as received the server acknowledgement

Asynchronous RPC
The following figure shows the interaction
between client and server using asynchronous
RPC

Client
Wait for acceptance
Call remote
Return from
call
procedure

Request
Server

Accept Request
call local

procedure

Time

Message-Oriented
Communication
There are two type of communication
Persistent versus transient
Synchronous versus asynchronous
Persistent: messages are held by the
middleware comm. service until they
can be delivered (e.g., email)

Sender can terminate after executing send


Receiver will get message next time it runs

Transient: messages exist only while the


sender and receiver are running

Message-Oriented
Communication
Asynchronous: (non-blocking) sender
resumes execution as soon as the message is
passed to the communication/middleware
software

Synchronous: sender is blocked until


The OS or middleware notifies acceptance
of the message, or
The message has been delivered to the
receiver, or
The receiver processes it & returns a
response

Message-Oriented
Communication

(a): persistent asynchronous communication


(b): persistent synchronous communication
(c): Transient asynchronous communication
(d): receipt-based Transient synchronous
communication
(E): delivery-based Transient synchronous
communication
(F): response-based Transient synchronous
communication