Chapter 2
Chapter 2
Chapter Two
Inter process communication
1
OUTLINE
ф Inter Process Communication: Introduction:
The API for the Internet Protocols,
External Data Representation and Marshalling,
Client-Server Communication, Group Communication,
Case Study: IPC in UNIX.
Communication between Distributed Objects,
2
INTRODUCTION
Inter-Process Communication (IPC) is a mechanism that allows processes to
communicate with each other and synchronize their actions.
The communication between these processes can be seen as a method of co-operation
between them.
Inter process communication is at the heart of distributed computing.
It makes no sense to study distributed systems without carefully examining the ways
that processes on different machines can exchange information.
We separate inter process communication into two parts:
1. Networking
2. User views
3
INTRODUCTION…
Networking: This deals with how processes communicate with one another via the various
protocol layers.
The important issues in networking are routing, error control, flow control, authentication, etc.
This is the internal view.
Users’ view: User processes have an abstract high-level view of the inter process communication
medium. This is the external view.
User processes run on host machines that are connected to one another through a network, and
the network carries signals that propagate from one process to another. These signals represent
data.
The processes may communicate across a LAN, or through the Internet, or a combination of
these, or via shared (virtual) address space.
Distributed systems use the client–server model. A few systems also adopt the P2P model of
inter process communication, where there is no difference between servers and clients.
User interfaces rely on programming tools available to a client for communicating with a server
4
INTER PROCESS COMMUNICATION (IPC)
A process is a program in execution.
A process can be executed in operating system into two types:
Independent process.
Co-operating process.
A independent process is not affected by the execution of other processes, which
are running independently, will execute very efficiently.
A co-operating process can be affected by other executing processes.
Any process that shares data with other processes is co-operating process.
co-operating process require IPC that allow them to exchange data and
information.
5
MODELS OF IPC
6
WHY IPC
Information Sharing
Resource Sharing
Increasing Computational Speed
Convenience,
Synchronization
Modularity.
7
APPLICATION PROGRAM INTERFACE (API) FOR
INTERNET PROTOCOLS
8
CHARACTERISTICS OF INTERCOMMUNICATION
Characteristics of IPC
Synchronous and asynchronous communication
In the synchronous form of communication, the sending and receiving
processes synchronize at every message.
In this case, both send and receive are blocking operations.
Blocking send has the sender block until the message is received.
Blocking receive has the receiver block until a message is available
10
CHARACTERISTICS OF INTERCOMMUNICATION
Message destinations
The messages in the Internet protocols, messages are sent to (Internet address,
local port) pairs.
A local port is a message destination within a computer, specified as an integer.
A port has exactly one receiver but can have many senders.
Processes may use multiple ports to receive messages.
Any process that knows the number of a port can send a message to it.
Client programs refer to services by name and use a name server or binder to
translate their names into server locations at runtime.
This allows services to be relocated but not to migrate – that is, to be moved
while the system is running.
12
Characteristics of intercommunication
Reliability
A point-to-point message service can be described as reliable if messages are
guaranteed to be delivered.
A point-to-point message service can be described as unreliable if messages are
not guaranteed to be delivered in the face of even a single packet dropped or
lost.
Ordering
Some applications require that messages be delivered in the order in which
they were transmitted by the sender.
The delivery of messages out of sender order is regarded as a failure by such
applications.
13
EXTERNAL DATA REPRESENTATION
Data structures are used to represent the information held in running applications.
The information consists of a sequence of bytes in messages that are moving between
components in a distributed system.
So, conversion is required from the data structure to a sequence of bytes before the transmission
of data.
On the arrival of the message, data should also be able to be converted back into its original data
structure.
Different types of data are handled in computers, and these types are not the same in every
position where data must be transmitted.
Individual primitive data items can have a variety of data values, and not all computers store
primitive values like integers in the same order.
14
EXTERNAL DATA REPRESENTATION & MARSHALING…
15
EXTERNAL DATA REPRESENTATION
If the two computers are known to be of the same type, the external format
conversion can be skipped otherwise before transmission, the values are
converted to an agreed-upon external format, which is then converted to
the local format on receiving.
For that, values are sent in the sender’s format, along with a description of
the format, and the recipient converts them if necessary. It’s worth noting,
though, that bytes are never changed during transmission.
Any data type that can be supplied as a parameter or returned, as a result,
must be able to be converted and the individual primitive data values
expressed in an accepted format to support Remote Procedure Call (RPC)
or Remote Method Invocation (RMI) mechanisms.
External Data Representation is a standard for representing data structures
16
and primitive values that have been agreed upon.
MARSHALLING
Marshalling: is the process of transferring and formatting a
collection of data structures into an external data
representation type appropriate for transmission in a message.
( write or transmit).
Unmarshalling: The converse of this process is
unmarshalling, which involves reformatting the transferred
data upon arrival to recreate the original data structures at the
destination.(read)
Approaches of data representation
There are three ways to successfully communicate between
various sorts of data between computers.1. Common Object
Request Broker Architecture (CORBA), 2. Java’s Object
Serialization, 3. Extensible Markup Language (XML): 17
COMMON OBJECT REQUEST BROKER ARCHITECTURE
(CORBA)
CORBA is a specification defined by the Object Management
Group (OMG) that is currently the most widely used
middleware in most distributed systems.
It allows systems with diverse architectures, operating
systems, programming languages, and computer hardware to
work together.
It allows software applications and their objects to
communicate with one another.
It is a standard for creating and using distributed objects. It is
made up of five major components.
Components and their function are given below:
18
COMMON OBJECT REQUEST BROKER ARCHITECTURE
(CORBA)
Object Request Broker (ORB): It provides a communication
infrastructure for the objects to communicate across a network.
Interface Definition Language (IDL): It is a specification language used
to provide an interface in a software component.
To exemplify, it allows communication between software components written
in C++ and Java.
Dynamic Invocation Interface (DII): Using DII, client applications are
permitted to use server objects without even knowing their types at
compile time.
Here client obtains an instance of a CORBA object and then invocation
requests can be made dynamically on the corresponding object.
Interface Repository (IR): As the name implies, interfaces can be added
to the interface repository.
The purpose of IR is that a client should be able to find an object which is not
known at compile-time and information about its interface then request is
made to be sent to ORB.
Object Adapter (OA): It is used to access ORB services like object 19
reference generation.
COMMON OBJECT REQUEST BROKER ARCHITECTURE
(CORBA)
20
COMMON OBJECT REQUEST BROKER ARCHITECTURE
(CORBA)
Data Representation in CORBA:
Common Data Representation (CDR) is used to describe
structured or primitive data types that are supplied as
arguments or results during remote invocations on CORBA
distributed objects.
It allows clients and servers’ built-in computer languages to
communicate with one another. To exemplify, it converts
little-endian to big-endian.
Primitive types are: short (16-bit), long (32-bit), unsigned
short, unsigned long, float (32-bit), double (64-bit), char,
boolean (TRUE, FALSE), octet (8-bit), and any (which can
represent any basic or constructed type), as well as a variety
of composite types. 21
COMMON OBJECT REQUEST BROKER ARCHITECTURE
(CORBA)
CORBA CDR Constructed Types:
Let’s have a look at Types with their representation:
sequence: It refers to length (unsigned long) to be followed by elements in order
string: It refers to length (unsigned long) followed by characters in order (can also
have wide characters)
array: The elements of the array follow order and length is fixed so not specified.
struct: in the order of declaration of components
enumerated: It is unsigned long and here, the values are specified by the order
declared.
union: type tag followed by the selected member
22
…
Common Object Request Broker Architecture (CORBA)
Example
struct Person {
string name;
string place;
long year;
};
Marshalling CORBA: From the specification of the categories of data items to be
transmitted in a message, Marshalling CORBA operations can be produced
automatically.
CORBA IDL describes the types of data structures and fundamental data items and
provides a language/notation for specifying the types of arguments and results of
RMI methods.
23
JAVA’S OBJECT SERIALIZATION
Java Remote Method Invocation (RMI) allows you to pass both objects and primitive
data values as arguments and method calls.
In Java, the term serialization refers to the activity of putting an object (an instance of a
class) or a set of related objects into a serial format suitable for saving to disk or
sending in a message.
Java provides a mechanism called object serialization.
This allows an object to be represented as a sequence of bytes containing information
about the object’s data and the type of object and the type of data stored in the object.
After the serialized object is written to the file, it can be read from the file and
deserialized. You can recreate an object in memory with type information and bytes that
represent the object and its data.
24
JAVA’S OBJECT SERIALIZATION
25
…
Java’s Object Serialization
Moreover, objects can be serialized on one platform and deserialized on completely different platforms as
the whole process is JVM independent.
For example, the Java class equivalent to the Person struct defined in CORBA IDL might be:
import java.io.*;
public class Person implements Serializable {
26
EXTENSIBLE MARKUP LANGUAGE (XML)
Clients communicate with web services using XML, which is
also used to define the interfaces and other aspects of web
services.
However, XML is utilized in a variety of different
applications, including archiving and retrieval systems; while
an XML archive is larger than a binary archive, it has the
advantage of being readable on any machine.
Other XML applications include the design of user interfaces
and the encoding of operating system configuration files.
Clients, for example, typically interface with web servers via
Simple Object Access Protocol SOAP messages.
SOAP is an XML standard with tags that web services and
27
their customers can utiliz
EXTENSIBLE MARKUP LANGUAGE (XML)…
Example
XML definition of the Person struct:
<person id="9865">
<name>John</name>
<place>England</place>
<year>1876</year>
<!-- comment -->
</person>
28
EXTENSIBLE MARKUP LANGUAGE (XML)…
To transmit data across COM object boundaries, the Microsoft
Component Object Model (COM) interface pointers employ
marshalling.
When a common-language-runtime-based type has to connect
with other unmanaged types via marshalling, the same thing
happens in the.NET framework.
DCOM stands for Distributed Component Object Model.
29
EXTENSIBLE MARKUP LANGUAGE (XML)…
Scripts and applications based on the Cross-Platform Component Object
Model (XPCOM) technology are two further examples where marshalling is
crucial.
The Mozilla Application Framework makes heavy use of XPCOM, which
makes considerable use of marshalling.
So, XML (Extensible Markup Language) is a text-based format for expressing
structured data. It was designed to represent data sent in messages exchanged
by clients and servers in web services
The primitive data types are marshalled into a binary form in the first two
ways- CORBA and Java’s object serialization.
The primitive data types are expressed textually in the third technique (XML).
A data value’s textual representation will typically be longer than its binary
representation. The HTTP protocol is another example of the textual approach.
On the other hand, type information is included in both Java serialization and
XML, but in distinct ways.
Although Java serializes all of the essential type information, XML documents
can refer to namespaces, which are externally specified groups of names (with 30
types).
SOCKETS
Both forms of communication (UDP and TCP) use the socket
abstraction, which provides an endpoint for communication
between processes.
Sockets originate from BSD UNIX but are also present in most
other versions of UNIX, including Linux as well as Windows and
the Macintosh OS.
Interprocess communication consists of transmitting a message
between a socket in one process and a socket in another process, as
illustrated fig socket port
For a process to receive messages, its socket must be bound to a
local port and one of the Internet addresses of the computer on
which it runs.
Messages sent to a particular Internet address and port number can
be received only by a process whose socket is associated with that
Internet address and port number.
31
SOCKETS…
For a process to receive messages, its socket must be bound to a local port and one of
the Internet addresses of the computer on which it runs. Messages sent to a particular
Internet address and port number can be received only by a process whose socket is
associated with that Internet address and port number.
32
SOCKETS
A socket is one endpoint of a two-way communication link between two
programs running on the network.
Interprocess communication consists of transmitting a message between a
basis for remote method invocation (RMI) or remote procedure call (RPC).
33
Group communication: The same message is sent to several processes.
GROUP COMMUNICATION
What is a group?
A number of processes which cooperate to provide a service.
An abstract identity to name a collection of processes.
Group Communication: For coordination among processes of
a group.
Who Needs Group Communication?
Highly available servers (client-server)
Database Replication
Multimedia Conferencing
Online Games
Cluster management
34
CLIENT SERVER COMMUNICATION
36
JAVA API FOR INTERNET ADDRESSES
UDP Datagram Communication
The application program interface to UDP provides a message passing abstraction.
Message passing is the simplest form of interprocess communication.
API enables a sending process to transmit a single message to a receiving process.
The independent packets containing theses messages are called datagrams.
In the Java and UNIX APIs, the sender specifies the destination using a socket.
A datagram is transmitted between processes when one process sends it and another receives
it.
The following are the steps in socket communication:
Creating a socket
Binding a socket to a port and local Internet address
A client binds to any free local port
A server binds to a server port
Receive() returns Internet address and port of sender, along with the message. 37
JAVA API FOR INTERNET ADDRESSES
38
JAVA API FOR INTERNET ADDRESSES
Blocking :
Sockets normally provide non-blocking sends and blocking receives for datagram communication.
The send() returns after delivering the message to the UDP and IP protocols. These protocols are now
responsible for transmitting the message to its destination
The message is placed in a queue for the socket that is bound to the destination port.
Messages are discarded at the destination if no process has a socket bound to the destination port.
The receive()blocks until a datagram is received, unless a timeout has been set on the socket.
Timeouts:
The receive() cannot wait indefinitely. This situation occurs when the sending process may have crashed
or the expected message may have been lost.
To avoid this timeouts can be set on sockets.
The timeouts must be much larger than the time required to transmit a message.
39
JAVA API FOR INTERNET ADDRESSES
41
JAVA API FOR UDP DATAGRAMS
The Java API provides datagram communication by two classes:
1. DatagramPacket
It provides a constructor to make an array of bytes comprising:
Message content
Length of message
Internet address
Local port number - It provides another similar constructor for
receiving a message.
42
JAVA API FOR INTERNET ADDRESSES
2. DatagramSocket:
This class supports sockets for sending and receiving UDP
datagram.
It provides a constructor with port number as argument.
43
DatagramSocket methods are:
1. send and receive: These methods are used for transmitting
datagrams between a pair of sockets.
Syntax:
send(packet);
receive();
2. setSoTimeout: This method allows a timeout to be set. With a timeout set, the
receive method will block for the time specified and then throw an
InterruptedIOException.
Syntax:
setSotimeout(time in seconds);
3. connect: This method is used for connecting to a particular remote port and
Internet address, in which case the socket is only able to send messages to and
receive messages from that address.
Syntax: int connect(in sockfd, const structsockaddr *addr, socklen_taddrlen);
44
Arrays of bytes Message length Internet address Port number
containing message
UDP Client server Server program
Communication Datagram Packet import java.net.*;
Client Program
import java.net.*; import java.io.*;
public class UDPServer
import java.io.*; {
public class UDPClient public static void main(String args[])
{ {
public static void main(String args[]) DatagramSocketaSocket = null;
try
{ {
DatagramSocketaSocket = null; aSocket = new DatagramSocket(6789);
try { byte[] buffer = new byte[1000];
aSocket = new DatagramSocket(); // Create an object for the while(true)
{
datagram class DatagramPacket request = new DatagramPacket(buffer, buffer.length);
byte [] m = args[0].getBytes(); //Buffer to get data aSocket.receive(request);
InetAddressaHost = InetAddress.getByName(args[1]); // Get DatagramPacket reply = new DatagramPacket(request.getData(),
Inetaddress request.getLength(), request.getAddress(), request.getPort());
aSocket.send(reply);
intserverPort = 6789; }
DatagramPacket request = }
new DatagramPacket(m, m.length(), aHost, serverPort); catch (SocketException e)
aSocket.send(request); //Sent the packet {
System.out.println("Socket: " + e.getMessage());
byte[] buffer = new byte[1000]; }
DatagramPacket reply = new DatagramPacket(buffer, catch (IOException e)
buffer.length); {
aSocket.receive(reply); System.out.println("IO: " + e.getMessage());
}
System.out.println("Reply: " + new String(reply.getData())); finally
} {
catch (SocketException e){System.out.println("Socket: " + if (aSocket != null) aSocket.close();}
e.getMessage()); }
}
}
catch (IOException e){System.out.println("IO: " + e.getMessage()); 45
}
finally { if(aSocket != null) aSocket.close();} } }
TCP STREAM COMMUNICATION
The API to the TCP protocol provides the abstraction of a stream of bytes to
be written to or read from.
The following features are hidden stream abstraction:
Message sizes
Lost messages
Flow control
Message destinations
46
WORKING OF STREAM COMMUNICATION
The pair of sockets in the client and server are connected by a pair of streams, one in each
direction. Thus each socket has an input stream and an output stream.
One of the pair of processes can send information to the other by writing to its output stream,
and the other process obtains the information by reading from its input stream.
When an application closes a socket, this indicates that it will not write any more data to its
output stream. Any data in the output buffer is flushed to the other end of the stream and put
in the queue at the destination socket, with an indication that the socket is closed.
The process at the destination can read the data in the queue, but any further reads after the
queue is empty will result in an indication of end of stream.
When a process exits or fails, all of its sockets are eventually closed and any process
attempting to communicate with it will discover that its connection has been broken.
47
This form of stream communication has the following issues:
Matching of data items: Two communicating processes need to
48
Java API for TCP streams
The Java interface to TCP streams is provided in the classes:
ServerSocket: It is used by a server to create a socket at server
port to listen for connect requests from clients.
Syntax:
publicServerSocket(int port, InetAddress address) ;
Socket: It is used by a pair of processes with a connection. The
client uses a constructor to create a socket and connect it to the
remote host and port of a server. It provides methods for
accessing input and output streams associated with a socket.
Syntax:
public Socket(InetAddress host, int port, InetAddresslocalAddress, intlocalPort);
49
TCP CLIENT SERVER COMMUNICATION
50
TCP SERVER
import java.net.*; import java.io.*;
public class TCPServer { public static void main (String args[]) { try{ intserverPort = 7896;
ServerSocketlistenSocket = new ServerSocket(serverPort); while(true) { Socket clientSocket =
listenSocket.accept();
Connection c = new Connection(clientSocket); } }
catch(IOException e) {System.out.println("Listen :"+e.getMessage());} } }
class Connection extends Thread { DataInputStream in;
DataOutputStream out; Socket clientSocket;
public Connection (Socket aClientSocket) { try { clientSocket = aClientSocket; in = new
DataInputStream( clientSocket.getInputStream());
out =new DataOutputStream( clientSocket.getOutputStream());
this.start(); } catch(IOException e) {System.out.println("Connection:"+e.getMessage());} } public
void run(){ try { // an echo server String data = in.readUTF(); out.writeUTF(data); }
catch(EOFException e) {System.out.println("EOF:"+e.getMessage()); }
catch(IOException e) {System.out.println("IO:"+e.getMessage()); }
finally { try {clientSocket.close();}catch (IOException e){/*close failed*/}} } }
51
CASE STUDY: IPC IN UNIX
The IPC primitives in BSD 4.x versions of UNIX are provided as system
calls that are implemented as a layer over the Internet TCP and UDP
protocols.
Message destinations are specified as socket addresses
a socket address consists of an Internet address and a local port number.
The inter process communication operations are based on the socket
abstraction.
messages are queued at the sending socket until the networking protocol has
transmitted them, and until an acknowledgement arrives, if the protocol
requires one.
When messages arrive, they are queued at the receiving socket until the
receiving process makes an appropriate system call to receive them.
52
CASE STUDY: IPC IN UNIX…
Any process can create a socket for use in communication with another process.
This is done by invoking the socket system call, whose arguments specify the
communication domain (normally the Internet), the type (datagram or stream) and
sometimes a particular protocol.
The protocol (for example, TCP or UDP) is usually selected by the system according to
whether the communication is datagram or stream.
The socket call returns a descriptor by which the socket may be referenced in
subsequent system calls. The socket lasts until it is closed or until every process
with the descriptor exits. A pair of sockets may be used for communication in both
or either direction between processes in the same or different computers.
Before a pair of processes can communicate, the recipient must bind its socket
descriptor to a socket address. The sender must also bind its socket descriptor to a
socket address if it requires a reply. The bind system call is used for this purpose;
its arguments are a socket descriptor and a reference to a structure containing the
socket address to which the socket is to be bound. Once a socket has been bound,
its address cannot be changed.
54
CASE STUDY: IPC IN UNIX…
It might seem more reasonable to have one system call for both socket creation and
binding a name to a socket, as for example in the Java API. The supposed
advantage of having two separate calls is that sockets can be useful without socket
addresses.
Socket addresses are public in the sense that they can be used as destinations by
any process. After a process has bound its socket to a socket address, the socket
may be addressed indirectly by another process referring to the appropriate socket
address. Any process, for example a server that plans to receive messages via its
socket, must first bind that socket to a socket address and make the socket address
known to potential clients.
55
COMMUNICATION BETWEEN DISTRIBUTED OBJECTS
Distributed object communication realizes communication between distributed objects in the
distributed computing environment.
The main role is to interconnect objects residing in non-local memory space and allow them to
perform remote calls and exchange data. Distributed object middleware offers a programming
abstraction based on object-oriented principles.
description about relation between objects and distributed objects:
56
COMMUNICATION BETWEEN DISTRIBUTED OBJECTS…
57
COMMUNICATION BETWEEN DISTRIBUTED OBJECTS
Distributed object is an object accessed by remotely
This means that distributed object can be used like a regular object,
but from anywhere on the network.
The object is typically considered to encapsulate data and behavior.
Distributed object model is a software module that are designed to
work together, but reside either in multiple computers connected via
network or in different computer inside the same computer.
Distributed object is the states of an object consists of the value of
its instance variable since object based programs are logically
portioned, the physical distribution of objects into different
processes or computers in distributed system.
Distributed object system may adopt the client server architecture.
Objects are managed servers and their clients invoke their methods 58
using remote method invocation.
COMMUNICATION BETWEEN DISTRIBUTED OBJECTS
Communication between distributed objects
Various middleware language like RMI required to make successful communication
between distributed objects.
Stub and skeleton objects works as Communication objects in distributed system.
RMI means remote method invocation. Whenever needed RMI invokes the methods at a
client and server side objects.
59
COMMUNICATION BETWEEN DISTRIBUTED OBJECTS
60
REMOTE METHOD INVOCATION
Remote Method Invocation (RMI) is an API that provides a
mechanism to create distributed application in java
The RMI allows an object to invoke methods on an object
running in another Java virtual machine JVM.
RMI provides a remote communication between the
applications using two objects stub and skeleton.
Understanding stub and skeleton
RMI uses stub and skeleton object for communication with
remote object
A remote object is an object whose method can be invoked
from another JVM 61
REMOTE PROCEDURE CALL
Remote Procedure Call (RPC) is a protocol 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.
Remote Procedure Call RPC is an intercrosses communication
technique.
It is used for client-server applications
RPC mechanisms are used when a computer program cause a
procedure or subroutine to execute in different address space, which
is coded as normal procedure call without the programmer
specifically coding the details for remote interaction
This procedure call manages low level transport protocol like UDP
or TCP
62
It is used for carrying the message data between programs.
REMOTE PROCEDURE CALL SEMANTICS
63
REMOTE PROCEDURE CALL
Is a special case of the general message-passing model of IPC.
Providing the programmers with familiar a mechanism for
building distributed system is one of primary motivations for
developing the RPC facility.
While RPC facility is not a universal panacea for all types of
distributed application, it does provide a valuable
communication mechanism that is suitable for building a
failrly large nmbers of distributed applications
The popularity of RPC as the primary mechanism for
distributed application is due to the following features:
64
REMOTE PROCEDURE CALL
1. Simple call syntax
2. Familiar semantics (b/ce similar to local procedure call)
3. its specified a well-defined interface. This property is used
to support compile time type checking and automated
interface generation
4. Its easy of use . The clean and simple semantics of a
procedure call makes it easier to build a distributed
computational and to get them right.
5. Its efficiency. Procedure call are simple enough for
communication to be quite rapid
6. It can be used as an IPC mechanism to communicate
between proceses on different machines as well as between
65
different proceses on the same machine,
IMPLEMENTING REMOTE PROCEDURE CALL
The stub is an object, acts as a gateway for the client side. All the outgoing to requests are
routed through it.
It resides at the client side and represented the remote object
To hide the underlying communication network, RPC communication package known as
RPC Runtime is used on both the sides.
The implementation of RPC involves the five elements of program:
1. Client
2. Client stub
3. RPC Runtime
4. Server stub
5. Server
66
REMOTE PROCEDURE CALL
The client, the client stub, and one instance of RPCRuntime
execute on the client machine
The server, the server stub, and one instance RPCRuntime execute
on the server machine
As far as, the client is concerned, romete services are accessed by
the user.
Client stub is responsible for the following two tasks
One receipt of call request from the client
It packs a specification of the target procedure and the arguments
into messages and
Asks the local Runtime to send it to the server stub
One receipt the result of procedure execution, it uplinks the result
and passes it to the client. 67
RPCRUNTIME
RPCRuntime handles transmission of messages across the
network between client and server machine
It is responsible
Retransmission
Acknowledgment
Routing
Encryption
68
SERVER STUB
Server stub is responsible for the following two tasks
On receipt of call request message from local RPCRuntime,
it unpacks it and makes a perfectly normal call to invoke the
appropriate procedure in the server
On receipt of the result of procedure execution from the
server, it unpacks the result into a message and then asks the
local RPCRuntime to send it to the client stub.
69
RPC MESSAGES
RPC messages
RPC system is independent of transport prortocol and is not
concerned as to how a message is passed from one proceses to
another.
Types of message involved in the implementation of RPC
system
Call messages
Reply messages
70
EVENTS AND NOTIFICATIONS
What is the idea behind the use of events? Publish-subscribe paradigm:
One object react to a change occurring in
another object The generator publish the type
Example: of events that it will make
manipulating with the mouse or entering text in available for observation by
a text box via the keyboard is an event which is
followed by a notification to the objects that are other objects
responsible for displaying a view of current
state. The receives subscribe to the
Communicate a shape added to a drawing types of events that are of
Modification to a document interest to them
Person has entered or left room
Piece of equipment or an electronically tagged
book is at a new location The receives receive
notifications of events when
the occur
71
EVENTS AND NOTIFICATIONS…
Events Distributed event-based systems
They extend the local event model by
Are the action performs on objects allowing multiple objects at different
Different event types may refer to locations to be notified of event taking
the different methods executed by place at an object
the object of interest They have tow main characteristics
Heterogeneous: Components in a
Notification: distributed system that were no designed
Objects that represent events to interpreted can be made to work
They may be: together
Asynchronous
Stored
Prevent publisher needing to synchronize
Sent in message with subscribes
Queried Publishers subscribe need to be decoupled
72
EVENTS AND NOTIFICATIONS…
Mushroom: an information provider processes
Is distributed event based system It receives new trading information
designed to support collaborative work,
in which the user interface display from a single external source
objects representing users and It implies the information to the
information's objects such as appropriate stock object
documents and notepads within shared
workspaces called network places. Each of the updates to a stock object
The sate of each place is replicated at is refereed as an event
the computers of users currently that The sock object notifies all of the
place dealers who have subscribed to the
Evets are used to describe changes to corresponding stock
objects and to a users focus of interest
There is a separate information
provider process for each external
source
73
EVENTS AND NOTIFICATIONS…
Simple dealing room system:
It takes is to allow dealers using computers to see the latest information about the market
prices of the stocks they deal in.
It could be modeled by with two different tasks
An information provider process
a dealer processes
A dealer processes
It creates an object to represent each named stock that the user asks to have displayed
The local object subscribes to the object representing that stock at the relevant information
provider
The local then receives all the information sent to it in notification and display it to the user.
74
THANK YOU FOR YOUR ATTENTION
75