P4L1: Remote Procedure Calls Flashcards

1
Q

What is the motivation for RPC?

A

The motivation for RPC is that many client-server programs share a lot of overlapping code (for communication and transport). It would be nice to not have to reimplement this “boilerplate” every time. RPCs allow us to capture the common steps and put this boilerplate under the hood. This eliminates opportunities for error and makes it easier to understand what our program is actually doing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe binding/registry in the context of RPCs

A

Binding is the mechanism by which the client connects to the server with the correct service (and correct version). This registry can be global, a distributed system on which any RPC can register, or it can be local and machine-based, or anything in between. This local registry will require that the client knows what server to connect to in the first place.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the failure semantics of RPCs

A

RPC systems are often unable to identify exactly what went wrong, or doing so would be prohibitively costly. Because of this, they provide errors that try to capture roughly what the error was without making any claim to identify the specific cause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe how interface specification works in RPCs

A

An interface design language (IDL) is used to describe the interface for the system, allowing the server to explicitly say what procedures it supports and what arguments it needs, and allowing the client to determine which server to bind with.

Describing the interface in a standardized way allows the RPC runtime to automate the stub generation process, generate the marshaling procedures, and generate the information that’s used in the service discovery process.

The IDL can be language-specific or language-agnostic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the tradeoffs regarding language-specific and language-agnostic IDLs?

A

Language-specific is good in the case that you understand the language it uses and would rather not learn the language-agnostic approach. Language-agnostic approaches are good if you don’t know the language your language-specific alternative is written in and don’t want to have to learn an entirely new language!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are two ways that RPCs can handle pointers?

A

A client cannot pass pointers to a server via RPC because the server almost certainly is in a different address space (or is even on a different machine!).

One way to handle this is to simply disallow pointers.

A more sophisticated solution is to accept pointers on the client side, serialize the data that they point to, and when the client eventually returns a result, enable it to return a pointer to the result rather than the value itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe the design decisions made by SunRPC regarding binding process, failure semantics, interface specification, and pointers

A

Sun RPC uses a machine-based registry, so your client needs to know what machine the server is on in order to connect.

The IDL is language agnostic and is used to specify both services and data encodings. On the server side, the implementation of the services must be coded to match the interface.

Sun RPC allows the use of pointers by serializing the data pointed to by them.

Sun RPC has a number of standard error codes that can be returned from an RPC call.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is marshalling/unmarshaling?

A

Marshaling is the process of taking arguments on the client side that are stored in disparate locations and putting them in one contiguous location in memory (a buffer) so they can be sent to the server.

Un-marshaling is the process of taking data from a contiguous buffer on the receiving side and using it to initialize data structures that correspond to argument types, i.e., the reverse process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does Sun RPC/XDR in particular serialize/deserialize complex, variable-size data structures?

A

In XDR specifically, a variable-length array is supported. When compiled, a variable length array will stored in memory as a data structure with two fields, one with its length and the other a pointer to the data. The sender sends both pieces of information, length first and then data, and the receiver knows to read the first four bytes to get the length of the incoming data. This determines how large of a memory buffer to allocate for the incoming data.

Strings, on the other hand, are stored in memory as a normal null-terminated array of characters. When serialized, they are serialized into a format like the variable-length array, with length and then data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does an RPC runtime serialize and deserialize complex variable size data structures?

A

The RPC will send a packet containing the RPC header and serialized data. In front of this packet will be a transport header.

Transport header: protocol and destination address

RPC header: procedure ID, version number, request ID

Arguments and results: serialized as a bytestream in a way that depends on data type so the server can reconstruct them on the other side.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly