2. Introduction
Inter-process communication (IPC).
Another virtual address space.
Another process on the same machine.
Another process on different machine.
Hides remote interaction.
Network programming standard 1980s
Builds on named pipes or Winsock.
Remote Method Invocation (RMI)
4. Cont….
When client code calls a remote
procedure, the client stub code
Retrieves the required parameters from the
client address space.
Marshals1
the parameters as needed into a
standard NDR2
format for transmission over the
network.
Calls functions in the RPC client run-time
library to send the request and its parameters
to the server.
1 Marshalling (similar to serialization) is the process of transforming the memory
representation of an object to a data format suitable for storage or transmission
2 Network Data Representation (NDR) is an implementation of the presentation layer in
the OSI model.
5. Cont…
The server performs the following steps to
call the remote procedure:
The server RPC run-time library functions
accept the request and call the server stub
procedure.
The server stub retrieves the parameters from
the network buffer and converts (i.e.
unmarshals) them from the network
transmission format to the format the server
needs.
The server stub calls the actual procedure on
the server.
6. Stubs
Client stub
Packs parameter into message.
Calls : Send & Receive.
Server Stub
Calls : Receive & Send.
Unpacks parameter from the message.
Details of message passing are hidden – two
libraries.
8. Steps
1. The client procedure calls the client stub in the normal way.
2. The client stub builds a message and traps to the kernel.
3. The kernel sends the message to the remote kernel.
4. The remote kernel gives the message to the server stub.
5. The server stub unpacks the parameters and calls the server.
6. The server does the work and returns the result to the stub.
7. The server stub packs it in a message and traps to the kernel.
8. The remote kernel sends the message to the clients kernel.
9. The client’s kernel gives the message to the client stub.
10. The stub unpacks the result and returns to the client.
10. Problems - Parameter Passing
Different Machine Types
Ex: IBM mainframes (EBCDIC) & IBM PCs(ASCII).
Different representation of Integers (1s
compliment & 2s Compliment), Floating point
numbers.
Numbering of bytes
Right to Left (Ex: Intel 486) – Little Endian.
Left to Right (Ex: Sun SPARC) – Big Endian.
13. Representation of Information
Canonical Form
Convert internal representation while
marshaling.
Ex:
2’s compliment for integers.
0 for ASCII.
1 for Boolean.
IEEE format for floating point no.
14. Pointer Passing
One way is to forbid the pointers & reference parameters in
general. – Highly undesirable
One strategy is copying the whole array/structure (simple)
into message.
Call by reference is replaced by copy/restore.
Optimization – Buffer knows if stub is an input / output
parameter. (Twice as efficient).
Pointer is followed (dereferenced) by putting it in the
register. – Highly Inefficient.
15. Dynamic Binding
Hardwiring network add. of server into client –
Extremely Inflexible
To avoid problems like
Replication of server
Relocation
Migration
Interface Change
16. Terms
Exports Interface
Imports Interface
Binder
Registering
Unique Id – Typically 32 bit long
Handle
System Dependent
IP Add. , Ethernet Add. , etc.
17. Disadvantages
Overhead Exporting & Importing
Costs Time
Many short lived client process may have to start over
again.
Binder may act as bottleneck in distributed system.
Registering / Deregistering of interfaces creates more
overhead.
18. RPC semantics-presence of failures
Unable to locate the server
Lost request message
Lost reply message
Server crashes
Client crashes
19. Unable to locate the server
When server is down it intimate the value
-1
Client is unable to locate the server
25. Request (R) protocol
Client Server
First
RPC
Next
RPC
Request message
Request message Procedure
execution
Procedure
execution
26. Request / Reply (RR) protocol
Client Server
First
RPC
Next
RPC
Request message
Request message
Procedure
execution
Procedure
execution
Reply message
Reply message
Also serves as acknowledgement
for the request message
Also serves as acknowledgement
for the request message
Also serves as acknowledgement
for the reply of the previous RPC