Remote Procedure Call (RPC)

In this lesson, we look at a programming language abstraction, RPC, to provide the basis for building distributed systems.

We'll cover the following

While OS abstractions turned out to be a poor choice for building distributed systems, programming language (PL) abstractions make much more sense. The most dominant abstraction is based on the idea of a remote procedure call, or RPC“Implementing Remote Procedure Calls” by Andrew D. Birrell, Bruce Jay Nelson. ACM TOCS, Volume 2:1, February 1984. The foundational RPC system upon which all others build. Yes, another pioneering effort from our friends at Xerox PARC. for shortIn modern programming languages, we might instead say remote method invocation (RMI), but who likes these languages anyhow, with all of their fancy objects?.

Remote procedure call packages all have a simple goal: to make the process of executing code on a remote machine as simple and straightforward as calling a local function. Thus, to a client, a procedure call is made, and sometime later, the results are returned. The server simply defines some routines that it wishes to export. The rest of the magic is handled by the RPC system, which in general has two pieces: a stub generator (sometimes called a protocol compiler), and the run-time library. We’ll now take a look at each of these pieces in more detail.

Stub generator

The stub generator’s job is simple: to remove some of the pain of packing function arguments and results in messages by automating it. Numerous benefits arise: one avoids, by design, the simple mistakes that occur in writing such code by hand. Further, a stub compiler can perhaps optimize such code and thus improve performance.

The input to such a compiler is simply the set of calls a server wishes to export to clients. Conceptually, it could be something as simple as this:

Get hands-on with 1200+ tech skills courses.