Distributed Objects
Distributed Objects
2
Interprocess Communication -
Characteristics
• Message passing between a pair of processes can be
supported by TWO message communication operations:
SEND and RECEIVE.
• This activity involves communication of data from sending
process to the receiving process and may involve the
synchronization of two process.
• Synchronous Communication – where S and R
synchronize at every message. Performs Blocking operation.
• Asynchronous Communication - S operation is non
blocking but R can be blocking or non blocking.
• Message Destination - Messages are sent as pairs
(Internet address, local port).
• Local port is message destination within computer,
3
specified as integer. Port has one receiver but many sender.
Interprocess Communication -
Characteristics
agreed port
any port
socket socket
message
client server
other ports
• Ordering
• Messages should be delivered in the order in which
they were transmitted by sender. If it is out of order
then it is regarded as failure by such application.
5
Client-server Communication
Request
doOperation
message getRequest
select object
(wait) execute
Reply method
message sendReply
(continuation)
6
Client-server Communication
doOperation();
Sends a request message to the remote server and returns
the reply.
The arguments specify the remote server, the operation to
be invoked and the arguments of that operation.
getRequest ();
Acquires a client request via the server port.
sendReply();
Sends the reply message back to the client at its Internet
address and port.
7
Client-server Communication
• Message Identifier consists of-
• A requestId from sending process in increasing sequence
and,
• An identifier for sender process <port , internet address>
9
Client-server Communication
• Time Out
• Are due to request or reply message getting lost.
• do-Operation can do after time out.
• For lost message do-Operation send request
repeatedly.
10
Client-server Communication
• Lost Reply Messages
• If server has already sent reply when it receives a
duplicate request it will need to execute the operation
again to obtain the result, unless it has stored the
result of original execution.
• Some servers can execute their operations more than
once and obtain the same results each time.
11
Client-server Communication
• RPC Exchange Protocol
• Three protocols with different semantics in
the presence of communication failure are
used for implementing various types of RPC.
• They are
• The request (R) protocol
• The request-reply (RR) protocol
• The request-reply- acknowledge reply
(RRA) protocol
12
Client-server Communication
• The R protocol is used when there is no value to
be returned from the procedure and the client
requires no confirmation that the procedure has
been executed
• The RR protocol is useful for client-server
exchange
• The RRA is based on exchange of three messages,
The acknowledge reply message contains the
requestId from the reply message being
acknowledged. This helps server in discarding
the message from history
13
Client-server Communication
14
Group Communication
The pair wise exchange of message is not the best model for
communication from one process to a group of other
processes, as for example when a service is implemented as a
number of different processes in different computers,
perhaps to provide fault tolerance or to enhance availability.
A multicast operation is more appropriate – this is an
operation that sends a single message from one process to
each of the members of a group of processes, usually in such
a way that the membership of the group is transparent to the
sender.
There is a range of possibilities in the desired behavior of a
multicast. The simplest provides no guarantees about
message delivery or ordering.
15
Group Communication - Characteristics
18
Reliability and ordering of multicast
The IP multicast suffers from omission failures.
• Recipients may drop the message because its buffer is full.
• One multicast router to another may be lost.
Another factor is that any process may fail.
Ordering is another issue.
19
Events and notifications
The idea behind the use of events is that one object can react
to a change occurring in another object.
Notification of events are essentially asynchronous and
determined by their receivers.
In particular, in interactive applications, the actions that the
user performs on objects, are seen as events that cause
changes in the objects that maintain the state of the
application.
The objects that are responsible for displaying a view of the
current state are notified whenever the state changes.
20
Events and notifications
Distributed event-based systems extend the local event
model by allowing multiple objects at different locations to
be notified of events taking place at an object.
They use the publish subscribe- paradigm, in which an
object that generates events publishes the type of events that
it will make available for observation by other objects.
Object that want to receive notification from an object that
has published its event subscribe to the types of events that
are of interest to them.
Objects that represent events are called notification.
Notification may be stored, sent in messages, queried and
applied in a variety of orders to different thing
21
Events and notifications
When a publisher experiences an event, subscribers that
expressed an interest in that type of event will receive
notifications.
Subscribing to a particular type of event is also called
registering interest in that type of event.
22
Events and notifications
Each event has attributes that specify information about
that event, such as the name or identifier of the object that
generated it, the operation, its parameters and the time
An event Sources can generate events of one or more
different types.
Distributed event based systems have two main
characteristics:
- Heterogeneous
- Asynchronous
23
Participants in Distributed Event
Notification
The object of Interest: Object that experiences changes of state, as a
result of its operations being invoked.
Event: An event occurs at an object of interest as the result of the
completion of a method execution.
Notifications: It is an object that contains information about an event
(type and its attributes).
Subscriber: It is an object that has subscribed to some type of events
in another object. It receives notifications about such events.
Observer objects: The main purpose is to decouple an object of
interest from its subscribers. An object of interest can have many
different subscribers with different interests.
Publisher: This is an object that declares that it will generate
notifications of particular types of event. A publisher may be an object
of interest or an observer.
24
Architecture of Distributed Event
Notification
26
Remote Procedure Call - Terms
• Client
• Server
• Endpoint
• Endpoint Mapper (EPM)
• Client Stub
• Server Stub
27
Remote Procedure Call - Process
• The RPC process starts on the client side.
• The client application calls a local stub procedure instead of code
implementing the procedure.
• Stubs are compiled and linked with the client application during
development.
• Instead of containing code that implements the remote procedure,
the client stub code retrieves the required parameters from the
client address space and delivers them to the client runtime library.
• The client runtime library then translates the parameters as
needed into a standard Network Data Representation (NDR) format
for transmission to the server
28
Remote Procedure Call - Process
29
Remote Procedure Call - Works
30
Remote Procedure Call - Process
31
Remote Procedure Call - Steps
1. The client calls a local procedure, called the client stub. To the
client process, it appears that this is the actual procedure. The client
stub packages the arguments to the remote procedure and builds
one or more network messages. The packaging of arguments into a
network
32
message is called marshaling.
Remote Procedure Call - Steps
2. Network messages are sent by the client stub to the remote system.
3. Network messages are transferred by the kernel to the remote system
via some protocol.
4. A server stub procedure on the server receives the messages. It
unmarshals the arguments from the messages and possibly converts them
from a standard form into a machine-specific form.
5. The server stub executes a local procedure call to the actual server
function, passing it the arguments that it received from the client.
6. When the server is finished, it returns to the server stub with its return
values.
7. The server stub converts the return values (if necessary) and marshals
them into one or more network messages to send to the client stub.
8. Messages get sent back across the network to the client stub.
33
Remote Procedure Call - Steps
7. The server stub converts the return values (if necessary) and
marshals them into one or more network messages to send to the
client stub.
8. Messages get sent back across the network to the client stub.
9. The client stub reads the messages from the local kernel.
10. It then returns the results to the client function (possibly
converting them first).
The client code then continues its execution
34
Remote Procedure Call - Advantages
• No need to worry about getting a unique transport address (a
socket on a machine). The server can bind to any port and register
the port with its RPC name server. The client will contact this
name server and request the port number that corresponds to the
program it needs.
• The system is transport independent. This makes code more
portable to environments that may have different transport
providers in use. It also allows processes on a server to make
themselves available over every transport provider on a system.
•Applications on the client only need to know one transport address
—that of the rpcbind (or portmap) process.
• The function-call model can be used instead of the send/receive
(read/write) interface provided by sockets.
35