What is an abstraction?

Abstraction is the process of obfuscating details that we don’t need. It allows us to concentrate on the big picture. Looking at the big picture is vital because it hides the inner complexities, thus giving us a broader understanding of our set goals and staying focused on them.

There are many scenarios where abstraction is useful. Abstraction allows generalisation and theoretical thinking about something. In computer science abstractions are used to make models that can be used and re-used without having to change code.

Let us take a look at some common abstractions

Database

Transaction is a database abstraction that symbolizes a unit of work, within a database management system against a database, that is treated in a coherent and reliable way, independent of other transactions.

That’s a great way of talking at a high level without going into the underlying details of what steps are involved in making a transaction. Why do we have transactions?

  • Provides a reliable unit of work that allows us to recover from failures properly and keep the database consistent at all times.
  • To provide isolation between the programs accessing the database concurrently

Abstractions in cloud/distributed systems

These abstractions help engineers to simplify their work and relieve them of the burden of dealing with the underlying complexity of the distributed system.

Network abstractions

Remote Procedure Calls

RPC is an interprocess communication protocol, that’s used in distributed systems. It provides an abstraction of local procedure call to developers by hiding complexities of packing and sending function arguments to a remote server, receiving return values and managing any retries over the network in case of failures.

In the Open Systems Interconnection model RPC spans over the transport and application layers.

seven layers of the OSI model

How does it work?

When you make a remote procedure call, from A to B, calling environment in A is paused and the procedure with parameters are sent over the network to the place where it is to be executed. Once execution on B is finished, the results are returned to the calling environment where execution restarts on a regular procedure call.

RPC in a diagram

The client stub

This component is responsible for:

  • retrieving the required parameters from the client address space
  • translate the parameters as needed into a standard format for transmission over the network
  • call the function in the rpc client run-time library to send the request and its parameters to the server

The server stub

This is responsible for:

  • retrieves the actual parameters from the network buffer, converts them from the network transmission format to the format that the server understands and calls the actual procedure on the server.
  • on the way back, the server stub does a similar conversion backwards, just like the client stub did when making the remote procedure call

The RPC runtime

The runtime library functions transmit the data on the network to the respective computers or vice-versa.

Read more about this in the following websites:

Summary

That’s RPC for you. Instead of calling a local procedure, the call is relayed over the network to a remote computer. It is the foundation for building distributed systems. This abstraction allows developers to quickly develop distributed application, focusing on designing solutions to real problems instead of focusing on machine and communication level specifics.