Distributed Systems U2
Distributed Systems U2
asia
UNIT-2
Failure model:
In a distributed system both processes and communication channels may fail – that
is, they may depart from what is considered to be correct or desirable behaviour.
The failure model defines the ways in which failure may occur in order to provide
an understanding of the effects of failures. Hadzilacos and Toueg provide a
taxonomy that distinguishes between the failures of processes and communication
channels. These are presented under the headings omission failures, arbitrary
failures and timing failures.
Omission failures • The faults classified as omission failures refer to cases when a
process or communication channel fails to perform actions that it is supposed to do.
process p process q
send m receive
Communication channel
Outgoing message buffer Incoming message buffer
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Arbitrary failures The term arbitrary or Byzantine failure is used to describe the
worst possible failure semantics, in which any type of error may occur. For
example, a process may set wrong values in its data items, or it may return a wrong
value in response to an invocation. An arbitrary failure of a process is one in which
it arbitrarily omits intended processing steps or takes unintended processing steps.
Arbitrary failures in processes cannot be detected by seeing whether the process
responds to invocations, because it might arbitrarily omit to reply. Communication
channels can suffer from arbitrary failures; for example, message contents may be
corrupted, nonexistent messages may be delivered or real messages may be
delivered more than once. Arbitrary failures of communication channels are rare
because the communication software is able to recognize them and reject the faulty
messages. For example, checksums are used to detect corrupted messages, and
message sequence numbers can be used to detect nonexistent and duplicated
messages.
Timing failures :
Timing failures are applicable in synchronous distributed systems where time limits
are set on process execution time, message delivery time and clock drift rate.
Timing failures are listed in the following figure. Any one of these failures may
result in responses being unavailable to clients within a specified time interval. In
an asynchronous distributed system, an overloaded server may respond too slowly,
but we cannot say that it has a timing failure since no guarantee has been offered.
Real-time operating systems are designed with a view to providing timing
guarantees, but they are more complex to design and may require redundant
hardware.
Most general-purpose operating systems such as UNIX do not have to meet real-
time constraints.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Integrity: The message received is identical to one sent, and no messages are
delivered twice. The threats to integrity come from two independent sources: Any
protocol that retransmits messages but does not reject a message that arrives twice.
Protocols can attach sequence numbers to messages so as to detect those that are
delivered twice. Malicious users that may inject spurious messages, replay old
messages or tamper with messages. Security measures can be taken to maintain the
integrity property in the face of such attacks.
Security model:
The sharing of resources as a motivating factor for distributed systems, and in
Section 2.3 we described their architecture in terms of processes, potentially
encapsulating higher-level abstractions such as objects, components or services, and
providing access to them through interactions with other processes. That
architectural model provides the basis for our security model: the security of a
distributed system can be achieved by securing the processes and the channels used
for their interactions and by protecting the objects that they encapsulate against
unauthorized access. Protection is described in terms of objects, although the
concepts apply equally well to resources of all types
Client
result Server
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Authentication: The use of shared secrets and encryption provides the basis for the
authentication of messages – proving the identities supplied by their senders. The
basic authentication technique is to include in a message an encrypted portion that
contains enough of the contents of the message to guarantee its authenticity. The
authentication portion of a request to a file server to read part of a file, for example,
might include a representation of the requesting principal’s identity, the identity of
the file and the date and time of the request, all encrypted with a secret key shared
between the file server and the requesting process. The server would decrypt this
and check that it corresponds to the unencrypted details specified in the request.
Secure channels: Encryption and authentication are used to build secure channels
as a service layer on top of existing communication services. A secure channel is a
communication channel connecting a pair of processes, each of which acts on
behalf of a principal, as shown in the following figure. A secure channel has the
following properties: Each of the processes knows reliably the identity of the
principal on whose behalf the other process is executing. Therefore if a client and
server communicate via a secure channel, the server knows the identity of the
principal behind the invocations and can check their access rights before performing
an operation. This enables the server to protect its objects correctly and allows the
client to be sure that it is receiving results from a bona fide server. A secure
channel ensures the privacy and integrity (protection against tampering) of the data
transmitted across it. Each message includes a physical or logical timestamp to
prevent messages from being replayed or reordered. Communication aspects of
middleware, although the principles discussed are more widely applicable. This one
is concerned with the design of the components shown in the darker layer in the
following figure.
Applications, services
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Distributed shared memory (DSM) is an abstraction used for sharing data between
computers that do not share physical memory. Processes access DSM by reads and
updates to what appears to be ordinary memory within their address space.
However, an underlying runtime system ensures transparently that processes
executing at different computers observe the updates made by one another.
The main point of DSM is that it spares the programmer the concerns of message
passing when writing applications that might otherwise have to use it. DSM is
primarily a tool for parallel applications or for any distributed application or group
of applications in which individual shared data items can be accessed directly. DSM
is in general less appropriate in client-server systems, where clients normally view
server-held resources as abstract data and access them by request (for reasons of
modularity and protection).
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Paged virtual memory:
Many systems, including Ivy and Mether , implement DSM as a region of
virtual memory occupying the same address range in the address space of
every participating process.
#include
"world.h"
struct
shared { int
a, b; };
Program
Writer:
main()
{
struct shared *p;
methersetup(); /* Initialize the
Mether runtime */ p = (struct
shared *)METHERBASE;
/* overlay structure on METHER
segment */ p->a = p->b = 0; /*
initialize fields to zero */
then an inconsistency may arise. Suppose a and b are initially zero and that process
1gets as far as setting a to 1. Before it can increment b, process 2 sets a to 2 and b to
1.
Consistency model
The local replica manager is implemented by a combination of middleware (the
DSM runtime layer in each process) and the kernel. It is usual for middleware to
perform the majority of DSM processing. Even in a page-based DSM
implementation, the kernel usually provides only basic page mapping, page-fault
handling and communication mechanisms and middleware is responsible for
implementing the page-sharing policies. If DSM segments are persistent, then one
or more storage servers (for example, file servers) will also act as replica managers.
Sequential consistency
Coherence
Weak consistency
This model exploits knowledge of synchronization operations in order to relax
memory consistency, while appearing to the programmer to implement sequential
consistency (at least, under certain conditions that are beyond the scope of this
book). For example, if the programmer uses a lock to implement a critical section,
then a DSM system can assume that no other process may access the data items
accessed under mutual exclusion within it. It is therefore redundant for the DSM
system to propagate updates to these items until the process leaves the critical
section.
While items are left with ‘inconsistent’ values some of the time, they are not
accessed at those points; the execution appears to be sequentially consistent.
Update options
Two main implementation choices have been devised for propagating updates made
by one process to the others: write-update and write-invalidate. These are applicable
to a variety of DSM consistency models, including sequential consistency. In
outline, the options are as follows:
Write-update: The updates made by a process are made locally and multicast to all
other replica managers possessing a copy of the data item, which immediately
modify the data read by local processes. Processes read the local copies of data
items, without the need for communication. In addition to allowing multiple
readers, several processes may write the same data item at the same time; this is
known as multiple-reader/multiple-writer sharing.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
For Ivy, Li and Hudak [1989] describe several architectures and protocols that take
varying approaches to these problems. The simplest we shall describe is their
improved centralized manager algorithm. In it, a single server called a manager is
used to store the location (transport address) of owner(p) for every page p. The
manager could be one of the processes running the application, or it could be any
other process. In this algorithm, the set copyset(p) is stored at owner(p). That is, the
identifiers and transport addresses of the members of copyset(p) are stored.
Pipelined RAM: All processors agree on the order of writes issued by any
given processor In addition to release consistency, hybrid models include:
Entry consistency: Entry consistency was proposed for the Midway DSM system. In
this model, every shared variable is bound to a synchronization object such as a
lock, which governs access to that variable. Any process that first acquires the lock
is guaranteed to read the latest value of the variable. A process wishing to write the
variable must first obtain the corresponding lock in
‘exclusive’ mode – making it the only process able to access the variable.
Several processes may read the variable concurrently by holding the lock in
nonexclusive mode. Midway avoids the tendency to false sharing in release
consistency, but at the expense of increased programming complexity.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Scope consistency: This memory model [Iftode et al. 1996] attempts to simplify the
programming model of entry consistency. In scope consistency, variables are
associated with synchronization objects largely automatically instead of relying on
the programmer to associate locks with variables explicitly. For example, the
system can monitor which variables are updated in a critical section.
Weak consistency: Weak consistency [Dubois et al. 1988] does not distinguish
between acquire and release synchronization accesses. One of its guarantees is that
all previous ordinary accesses complete before either type of synchronization
access completes.
CORBA IDL
These are preceded by definitions of two structs, which are used as parameter types
in defining the methods. Note in particular that GraphicalObject is defined as a
struct , whereas it was a class in the Java RMI example. A component whose type is
a struct has a set of fields containing values of various types like the instance
variables of an object, but it has no methods.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Parameters and results in CORBA IDL:
Each parameter is marked as being for input or output or both, using the keywords
in , out or inout illustrates a simple example of the use of those keywords
The equivalent Java interfaces – two per IDL interface. The name of the first Java
interface ends in Operations – this interface just defines the operations in the IDL
interface. The Java second interface has the same name as the IDL interface and
implements the operations in the first interface as well as those in an interface
suitable for a CORBA object.
The server skeletons for each idl interface. The names of skeleton classes end in
POA , for example ShapeListPOA.
The proxy classes or client stubs, one for each IDL interface. The names of these
classes end in Stub , for example _ShapeListStub\
A Java class to correspond to each of the structs defined with the IDL interfaces.
In our example, classes Rectangle and GraphicalObject are generated. Each of
these classes contains a declaration of one instance variable for each field in the
corresponding struct and a pair of constructors, but no other methods.
Classes called helpers and holders, one for each of the types defined in the IDL
interface. A helper class contains the narrow method, which is used to cast down
from a given object reference to the class to which it belongs, which is lower down
the class hierarchy. For example, the narrow method in ShapeHelper casts down to
class Shape . The holder classes deal with out and inout arguments, which cannot be
mapped directly onto Java.
Server program
The server program should contain implementations of one or more IDL interfaces.
For a server written in an object-oriented language such as Java or C++, these
implementations are implemented as servant classes. CORBA objects are instances
of servant classes.
When a server creates an instance of a servant class, it must register it with the
POA, which makes the instance into a CORBA object and gives it a remote object
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
reference. Unless this is done, the CORBA object will not be able to receive remote
invocations. Readers who studied Chapter 5 carefully may realize that registering
the object with the POA causes it to be recorded in the CORBA equivalent of the
remote object table.
Callbacks
Callbacks can be implemented in CORBA in a manner similar to the one described
for Java RMI For example, the WhiteboardCallback interface may be defined as
follows:
interface
WhiteboardCallback {
oneway void
callback(in int version);
};
This interface is implemented as a CORBA object by the client, enabling the server
to send the client a version number whenever new objects are added. But before the
server can do this, the client needs to inform the server of the remote object
reference of its object. To make this possible, the ShapeList interface requires
additional methods such as register and deregister, as follows:
int register(in
WhiteboardCallback callback);
void deregister(in int
callbackId);
After a client has obtained a reference to the ShapeList object and created an
instance of
WhiteboardCallback, it uses the register method of ShapeList to inform the server
that it is interested in receiving callbacks. The ShapeList object in the server is
responsible for keeping a list of interested clients and notifying all of them each
time its version number increases when a new object is added.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The architecture of CORBA
The architecture is designed to support the role of an object request broker that
enables clients to invoke methods in remote objects, where both clients and servers
can be implemented in a variety of programming languages. The main components
of the CORBA architecture are illustrated in Figure
CORBA provides for both static and dynamic invocations. Static invocations are
used when the remote interface of the CORBA object is known at compile time,
enabling client stubs and server skeletons to be used. If the remote interface is not
known at compile time, dynamic invocation must be used. Most programmers
prefer to use static invocation because it provides a more natural programming
model.
ORB core ◊ The role of the ORB core is similar to that of the communication
module . In addition, an ORB core provides an interface that includes the following:
operations enabling it to be started and stopped;
operations to convert between remote object references and strings;
operations to provide argument lists for requests using dynamic invocation.
Object adapter
The role of an object adapter is to bridge the gap between CORBA objects with
IDL interfaces and the programming language interfaces of the corresponding
servant classes. This role also includes that of the remote reference and dispatcher
modules. An object adapter has the following tasks:
it creates remote object references for CORBA objects;
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
between the POA and the servants. The POA supports CORBA objects with two
different sorts of lifetimes:
those whose lifetimes are restricted to that of the process their servants are
instantiated in;
those whose lifetimes can span the instantiations of servants in multiple
processes.
Skeletons
Skeleton classes are generated in the language of the server by an IDL compiler. As
before, remote method invocations are dispatched via the appropriate skeleton to a
particular servant, and the skeleton unmarshals the arguments in request messages
and marshals exceptions and results in reply messages.
Client stubs/proxies
These are in the client language. The class of a proxy (for object oriented
languages) or a set of stub procedures (for procedural languages) is generated from
an IDL interface by an IDL compiler for the client language. As before, the client
stubs/proxies marshal the arguments in invocation requests and unmarshal
exceptions and results in replies.
Implementation repository
An implementation repository is responsible for activating registered servers on
demand and for locating servers that are currently running. The object adapter
name is used to refer to servers when registering and activating them. An
implementation repository stores a mapping from the names of object adapters to
the pathnames of files containing object implementations.
Object implementations and object adapter names are generally registered with the
implementation repository when server programs are installed. When object
implementations are activated in servers, the hostname and port number of the
server are added to the mapping.
jntuworldupdates.org Specworld.in