Unit I MC4203 CC_pdf
Unit I MC4203 CC_pdf
Part A
1) What is a distributed system?
A distributed system is one in which components located at networked computers
communicate and coordinate their actions only by passing messages. The components
interact with each other in order to achieve a common goal.
Mrs.J.Srivandhana.,AP/MCA Page 1
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
† Heterogeneity
† Openness
† Security
† Scalability
† Failure handling
† Concurrency
† Transparency
† Quality of service
7) What are the 2 security challenges that are not fully met by distributed systems?
Denial of service attacks: One of the security problems is that a user may wish to
disrupt a service for some reason. This can be achieved by bombarding the service
with such a large number of pointless requests that the serious users are unable to use
it. This is called a denial serviceof attack. There have been several denial of service
attacks on well-known web services.
Security of mobile code: Mobile code needs to be handled with care. Consider
someone who receives an executable program as an electronic mail attachment. The
possible effects of running the program are unpredictable.
Mrs.J.Srivandhana.,AP/MCA Page 2
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Σ 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.
Σ 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.
Σ Redundancy: Services can be made to tolerate failures by the use of redundant
components.
Mrs.J.Srivandhana.,AP/MCA Page 3
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Group communication offers a service whereby a message is sent to a group and then
this message is delivered to all members of the group. In this action, the sender is not aware
of the identities of the receivers.
A group is said to be closed if only members of the group may multicast to it. A
process in a closed group delivers to itself any message that it multicasts to the group. A
group is open if processes outside the group may send to it.
Causal ordering takes into account causal relationships between messages, in that if a
message happens before another message in the distributed system this so-called causal
relationship will be preserved in the delivery of the associated messages at all processes.
Mrs.J.Srivandhana.,AP/MCA Page 4
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
represented by processes or objects in a set of computers that interact with each other to
implement communication and resource sharing support for distributed applications.
PART B
1) INTRODUCTION TO DISTRIBUTED SYSTEMS.
Definition:
Introduction
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.
Mrs.J.Srivandhana.,AP/MCA Page 5
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
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 independently, leaving the others still running.
To place distributed systems in a realistic context through examples: the Internet, an intranet
and mobile computing.
Mrs.J.Srivandhana.,AP/MCA Page 6
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
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.
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.
ii. It benefits users while they remain in a single environment such as home.
Distributed In Figure 3 user has access to three forms of wireless connection:
Mrs.J.Srivandhana.,AP/MCA Page 7
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 8
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
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 independently, leaving the others still
running.
Mrs.J.Srivandhana.,AP/MCA Page 9
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 10
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 11
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 12
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 13
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 14
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 15
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 16
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Remote Invocation
1. Introduction
2. Remote Method Invocation (RMI)
3. RMI Invocation Semantics
Remote Invocation
• RPC (Remote Procedure Call)
‣ allows client programs to call procedures in server programs running in
separate processes (and generally in different computers from the client)
• RMI (Remote Method Invocation)
Mrs.J.Srivandhana.,AP/MCA Page 17
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
• Objects can encapsulate their data and the code of their methods
• Some languages (JAVA, C++) allow programmers to define objects whose instance variables
can be accessed directly
• BUT in a distributed object system, an object’s data should be accessible only via its
methods (or interface)
Mrs.J.Srivandhana.,AP/MCA Page 18
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 19
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 20
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 21
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 22
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 23
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
† Remote Procedure Call (RPC) Distributed operating systems are typically structured
around the client-server paradigm. In this model, a user process, called the client,
requests another user process, called the server, to perform some work for it by
sending the server a message and then blocking until the server sends back a reply.
† The communication mechanism used to implement the client-server model is called
RPC. The RPC abstraction lets the programmer think in terms of normal procedure
calls, which are well understood and have been around for a long time.
† This is in sharp contrast with, for example, the ISO OSI model. In this model,
communication is treated as an input/output device, with user primitives for sending
messages and getting indications of message arrivals. Many people think that
input/output should not be the central abstraction of a modern programming
language. Therefore, most distributed system builders, language designers, and
programmers prefer RPC.
Mrs.J.Srivandhana.,AP/MCA Page 24
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 25
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Broadcast Communication :
When the host process tries to communicate with every process in a distributed
system at same time. Broadcast communication comes in handy when a common
stream of information is to be delivered to each and every process in most
efficient manner possible.
Since it does not require any processing whatsoever, communication is very fast
in comparison to other modes of communication. However, it does not support a
large number of processes and cannot treat a specific process individually.
Multicast Communication :
Mrs.J.Srivandhana.,AP/MCA Page 26
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
A multicast Communication: P1 process communicating with only a group of the process in the system
Unicast Communication :
When the host process tries to communicate with a single process in a distributed
system at the same time. Although, same information may be passed to multiple
processes. This works best for two processes communicating as only it has to treat
a specific process only. However, it leads to overheads as it has to find exact
process and then exchange information/data.
Mrs.J.Srivandhana.,AP/MCA Page 27
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
The term multicast means the use of a single communication primitive to send a message to a
specific set of processes rather than using a collection of individual point to point message
primitives. This is in contrast with the term broadcast which means the message is addressed to
every host or process.
Multicast
• 1 process sends a message to a group of other processes
• More efficient than looping in the application sending a message to each
• May be able to guarantee that either all recipients get the message or none does.
A consensus protocol allows a group of participating processes to reach a common decision, based
on their initial inputs, despite failures.
Mrs.J.Srivandhana.,AP/MCA Page 28
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
A client wishes to obtain a service which can be performed by any member of the
group without affecting the state of the service.
Mrs.J.Srivandhana.,AP/MCA Page 29
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
In the second case, the all-or-none atomic delivery requirements requires that the multicast
needs to be buffered until it is committed and subsequently delivered to the application
process, and so incurs additional latency.
Failure may occur during a multicast at the recipient processes, the communication links or
the originating process.
Failures at the recipient processes and on the communication links can be detected by the
originating process using standard time-out mechanisms or message acknowledgements.
The multicast can be aborted by the originator, or the service group membership may be
dynamically adjusted to exclude the failed processes and the multicast can be continued.
If the originator fails during the multicast, there are two possible outcomes. Either the
message has not have arrived at any destination or it has arrived at some. In the first case,
no process can be aware of the originator's intention and so the multicast must be aborted.
In the second case it may be possible to complete the multicast by selecting one of the
recipients as the new originator. The recipients would have to buffer messages until safe
for delivery in case they were called on for this role.
A reliable multicast protocol imposes no restriction on the order in which messages are
delivered to group processes. Given that multicasts may be in progress by a number of
originators simultaneously, the messages may arrive at different processes in a group in
different orders. Also, a single originator may have a number of simultaneous multicasts in
progress or may have issued a sequence of multicast messages whose ordering we might
like preserved at the recipients. Ideally, multicast messages should be delivered
instantaneously in the real-time order they were sent, but this is unrealistic as there is no
global time and message transmission has a possibly significant and variable latency.
A number of possible scenarios are given below which may require different levels of
ordering semantics. G and s represent groups and message sources. s may be inside or
outside a group. Note that group membership may overlap with other groups, that is,
processes may be members of more than one group.
Mrs.J.Srivandhana.,AP/MCA Page 30
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
(a) (b)
(d)
However, the content of message m may also depend on messages that the sender of m
received from other sources before sending m. The application may require that the context
which could have caused or affected the content of m be delivered at all destinations of m,
Mrs.J.Srivandhana.,AP/MCA Page 31
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
before m. For example, in a network news application, user A broadcasts an article. User B
at a different site receives the article and broadcasts a response. User C can only interpret
the response if the original article is delivered first at their site. Two messages are said to
be causally related if one message is generated after receipt of the other. Causal order is a
strengthening of FIFO ordering which ensures that a message is not delivered until all
messages it depends on have been delivered.
The definition of causal ordering does not determine the delivery order of messages which
are not causally related. Consider a replicated database application with two copies of a
bank account x residing at different sites. A client side process at one site sends a multicast
to the database to lodge £100 to account x. At another site simultaneously, a client side
process initiates a multicast to add 10% interest to the current balance of x. For consistency,
all database replicas should apply the two updates in the same sequence. As these two
messages are not causally related, a causal broadcast would allow the update messages to x
to be delivered in different sequences at the replicas.
Total Ordering guarantees that all correct processes receive all messages in the same order.
That is, if correct processes p and q both receive messages m and m', then p receives m before m' if
and only if q receives m before m'. The multicast is atomic across all members of the group.
Note that this definition of a totally ordered broadcast does not require that messages be
delivered in Causal Order or even FIFO Order, so it is not stronger than these orderings.
For example, if a process suffers a transient failure during the broadcast of message m, and
subsequently broadcasts m', a totally ordered protocol will guarantee only that processes
receive m'.
FIFO or Causal Ordering can be combined with Total Ordering if required.
Mrs.J.Srivandhana.,AP/MCA Page 32
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
The protocols only differ in the strength of their message delivery order requirements.
Multicast Algorithms
In the algorithms to follow, R stands for Reliable Multicast, F for FIFO, C for Causal and A
for Atomic.
In an asynchronous system where a reliable link exists between every pair of processes, the
algorithm below demonstrates how a Reliable multicast can be achieved.
multicast(F, m):
multicast(R, m)
Mrs.J.Srivandhana.,AP/MCA Page 33
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Initialisation:
prevReceives = ^
multicast(C, m):
multicast(F, <prevReceives || m>) /* || is list concatenation operator */
prevReceives = ^
If we assume no failures, the algorithm given below can be used to implement a totally
ordered multicast.
Each site maintains a 'local clock'. A clock doesn't necessarily have to supply the exact
time, but could be implemented simply by a counter which is incremented after
Mrs.J.Srivandhana.,AP/MCA Page 34
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
each send or receive event that occurs at the site, so that successive events have different
'times'.
The algorithm executes in two phases. During the first phase the originator multicasts the
message to all destinations and awaits a reply from each. Each receiver queues the message
and assigns it a proposed timestamp based on the value of its local clock. This timestamp is
returned to the originator. The originator collects all the proposed timestamps for the
multicast and selects the highest. During the second phase of the algorithm, the originator
commits the multicast by sending the final chosen timestamp to all destinations. Each
receiver then marks the message as deliverable in its queue. The message queue is ordered
on the value of the timestamps associated with each message each time a timestamp is
updated. When a message gets to the top of the queue and is deliverable it may be
delivered immediately to the application.
Each site returns the timestamps it assigned the respective messages to their originators.
Let's say the originator of m1 is the first to get all replies and issues a commit with
timestamp = 17.3.
Site 1 Site 2 Site 3
Message m1 is now
deliverable at Site3.
If a commit for message m2 should arrive at the sites with timestamp = 19.3 we get:-
Site 1 Site 2 Site 3
Mrs.J.Srivandhana.,AP/MCA Page 35
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Latency Cost: Each message which arrives at a site must wait in a queue for a commit and
until all messages with earlier timestamp in the queue are delivered.
Bandwidth Cost: The protocol involves the exchange of several messages:- The original
multicast, all the individual timestamp messages returned by the recipients and the final
commit multicast.
Storage Cost: Messages are stored in a queue from time of arrival until time of delivery. This
time may be longer if reliable delivery is required to all destinations as a site may have to
take the role of initiator.
The causal multicast generally incurs less latency cost as messages can be delivered without having
to wait for a commit. The size of each message may be larger due to the forwarding of causal
dependent context with the message. The effect of this is not too severe however as with most
systems it is often the additional number of messages and not their size which is
Mrs.J.Srivandhana.,AP/MCA Page 36
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
7) Time Ordering
s
synchronization of the order of minutes
ocal clock
Mrs.J.Srivandhana.,AP/MCA Page 37
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 38
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 39
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 40
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 41
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Time server can handle faulty clocks by eliminating client clock values that
are too low or too high
What if the time server fails? Just elect another node as the time server (Leader
Election Problem)
Note that the actual time of the central server does not matter, enough for it
to tick at around the same rate as other clocks to compute average correctly
(why?)
Mrs.J.Srivandhana.,AP/MCA Page 42
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Measurement of Time
Astronomical Time
Traditionally used
Based on earth’s rotation around its axis and around the sun
Solar day : interval between two consecutive transits of the sun
Solar second : 1/86,400 of a solar day
Period of earth’s rotation varies, so solar second is not stable
Mean solar second : average length of large no of solar days, then
divide by 86,400
Atomic Time
Based on the transitions of Cesium 133 atom
1 sec. = time for 9,192,631,770 transitions
Many labs worldwide maintain a network of atomic clocks
International Atomic Time (TAI) : mean no. of ticks of the clocks
since Jan 1, 1958
Highly stable
But slightly off-sync with mean solar day
A leap second inserted occasionally to bring it in sync.
Mrs.J.Srivandhana.,AP/MCA Page 43
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
UTC time is broadcast from different sources around the world, ex.
National Institute of Standards & Technology (NIST) – runs WWV radio
station, anyone with a proper receiver can tune in
United States Naval Observatory (USNO) – supplies time to all
defense sources
National Physical Laboratory in UK
Satellites
Many others
Accuracies can vary (< 1 milliseconds to a few milliseconds)
Mrs.J.Srivandhana.,AP/MCA Page 44
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 45
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 46
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 47
MC5207 UNIT-1 CLOUD COMPUTING TECHNOLOGIES I MCA- II SEM
Mrs.J.Srivandhana.,AP/MCA Page 48