Remote Procedure Call: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (ported RPC page)
 
m (Minor grammar fixes, added pre tags for drawing to be safe.)
 
Line 7: Line 7:
== Remote Procedure Calls in a nutshell ==
== Remote Procedure Calls in a nutshell ==


A RPC system relies on a compiler that will generate helper code from a high-level interface description (usually IDL, "Interface Description Language"). The 'client' code that wish to call a service will actually call a proxy function locally, passing it the arguments for the remote code. The proxy then marshalls (or serializes) the arguments according so that they fit in a flat buffer and send that buffer to the server code (for instance involving a UDP packet or some local message queue) and waits for response.
An RPC system relies on a compiler that will generate helper code from a high-level interface description (usually IDL or ''Interface Description Language''). The 'client' code that wishes to call a service will actually call a proxy function locally, passing it the arguments for the remote code. The proxy then marshalls (or serializes) the arguments according so that they fit in a flat buffer and send that buffer to the server code (for instance involving a UDP packet or some local message queue) and waits for response.


On its side, the server suddenly receive the marshalled packet and will pass it to a stub that will re-create the data (unmarshall) and call the real service procedure, getting back the results and marshall them back in a message to the client.
The server will suddenly receive the marshalled packet and pass it to a stub that will recreate the data (unmarshall) and call the real service procedure, retrieving the results and marshall them back in a message to the client.


<pre>
( client ) ( server )
( client ) ( server )
| ^
| ^
Line 29: Line 30:
| interface) |
| interface) |
+--------------+
+--------------+
</pre>


[[Category:IPC]]
[[Category:IPC]]

Latest revision as of 09:18, 5 June 2012

What is RPC

Remote Procedure Calls, or RPC's for short, are a means to have certain services executed by some code that lies in an different process (maybe even on a machine located somewhere in the network), instead of being available locally. This is a common practice, employed e.g. by application servers or web applications.

Popular protocols for RPC's are COM+, Corba, or SOAP.

Remote Procedure Calls in a nutshell

An RPC system relies on a compiler that will generate helper code from a high-level interface description (usually IDL or Interface Description Language). The 'client' code that wishes to call a service will actually call a proxy function locally, passing it the arguments for the remote code. The proxy then marshalls (or serializes) the arguments according so that they fit in a flat buffer and send that buffer to the server code (for instance involving a UDP packet or some local message queue) and waits for response.

The server will suddenly receive the marshalled packet and pass it to a stub that will recreate the data (unmarshall) and call the real service procedure, retrieving the results and marshall them back in a message to the client.

 ( client )                                    ( server )
      |                                            ^
      | sayHello("World")                          | serverSayHello("World")
      V                                            |
   +------\     -  -  - <channel>-  -  -  -   \-------+
   | PROXY > ->  iXX mYY Str'W o r l d \0'  -> > STUB |
   +------/     -  -  -  -  - |-  -  -  -     /-------+
                              |
                   marshalled message
       ^                                           ^
      /_\                                         /_\
       :                                           :
       :                                           :
       :               |------------|\             :
       :               | .idl file  L_\            :
       +  - compiler - | (describing  | - compiler +
                       |  interface)  |
                       +--------------+