Libraries and BIFS for Distributed Programming

When we write distributed programs, we very rarely start from scratch. In the standard libraries, there are a number of modules that can be used to write distributed programs. These modules are written using the distribution BIFs, but they hide a lot of the complexity from the programmer.

Two modules in the standard distribution cover most needs.

  • rpc provides a number of remote procedure call services.

  • global has functions for the registration of names and locks in a distributed system and for the maintenance of a fully connected network.

The single most useful function in the module rpc is the following:

call(Node, Mod, Function, Args) -> Result | {badrpc, Reason}

This evaluates apply(Mod, Function, ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.