User's Guide
Reference Manual
Release Notes
PDF
Top

Erlang Run-Time System Application (ERTS)
User's Guide
Version 5.10.2

Expand All
Contract All

Chapters

- Communication in Erlang
  - Top of chapter
  - Passing of Signals
  - Synchronous Communication
  - Implementation
- Match specifications in Erlang
  - Top of chapter
  - Grammar
  - Function descriptions
  - Variables and literals
  - Execution of the match
  - Differences between match specifications in ETS and tracing
  - Examples
- How to interpret the Erlang crash dumps
  - Top of chapter
  - General information
  - Memory information
  - Internal table information
  - Allocated areas
  - Allocator
  - Process information
  - Port information
  - ETS tables
  - Timers
  - Distribution information
  - Loaded module information
  - Fun information
  - Process Data
  - Atoms
  - Disclaimer
- How to implement an alternative carrier for the Erlang distribution
  - Top of chapter
  - Introduction
  - The driver
  - Putting it all together
- The Abstract Format
  - Top of chapter
  - Module declarations and forms
  - Atomic literals
  - Patterns
  - Expressions
  - Clauses
  - Guards
  - The abstract format after preprocessing
- tty - A command line interface
  - Top of chapter
  - Normal Mode
  - Shell Break Mode
- How to implement a driver
  - Top of chapter
  - Introduction
  - Sample driver
  - Compiling and linking the sample driver
  - Calling a driver as a port in Erlang
  - Sample asynchronous driver
  - An asynchronous driver using driver_async
- Inet configuration
  - Top of chapter
  - Introduction
  - Configuration Data
  - User Configuration Example
- External Term Format
  - Top of chapter
  - Introduction
  - Distribution header
  - ATOM_CACHE_REF
  - SMALL_INTEGER_EXT
  - INTEGER_EXT
  - FLOAT_EXT
  - ATOM_EXT
  - REFERENCE_EXT
  - PORT_EXT
  - PID_EXT
  - SMALL_TUPLE_EXT
  - LARGE_TUPLE_EXT
  - NIL_EXT
  - STRING_EXT
  - LIST_EXT
  - BINARY_EXT
  - SMALL_BIG_EXT
  - LARGE_BIG_EXT
  - NEW_REFERENCE_EXT
  - SMALL_ATOM_EXT
  - FUN_EXT
  - NEW_FUN_EXT
  - EXPORT_EXT
  - BIT_BINARY_EXT
  - NEW_FLOAT_EXT
  - ATOM_UTF8_EXT
  - SMALL_ATOM_UTF8_EXT
- Distribution Protocol
  - Top of chapter
  - EPMD Protocol
  - Distribution Handshake
  - Protocol between connected nodes
  - New Ctrlmessages for distrvsn = 1 (OTP R4)
  - New Ctrlmessages for distrvsn = 2
  - New Ctrlmessages for distrvsn = 3 (OTP R5C)
  - New Ctrlmessages for distrvsn = 4 (OTP R6)

# 1 Communication in Erlang

Communication in Erlang is conceptually performed using asynchronous signaling. All different executing entities such as processes, and ports communicate via asynchronous signals. The most commonly used signal is a message. Other common signals are exit, link, unlink, monitor, demonitor signals.

### 1.1 Passing of Signals

The amount of time that passes between a signal being sent and the arrival of the signal at the destination is unspecified but positive. If the receiver has terminated, the signal will not arrive, but it is possible that it triggers another signal. For example, a link signal sent to a non-existing process will trigger an exit signal which will be sent back to where the link signal originated from. When communicating over the distribution, signals may be lost if the distribution channel goes down.

The only signal ordering guarantee given is the following. If an entity sends multiple signals to the same destination entity, the order will be preserved. That is, if A sends a signal S1 to B, and later sends the signal S2 to B, S1 is guaranteed not to arrive after S2.

### 1.2 Synchronous Communication

Some communication is synchronous. If broken down into pieces, a synchronous communication operation, consists of two asynchronous signals. One request signal and one reply signal. An example of such a synchronous communication is a call to process_info/2 when the first argument is not self(). The caller will send an asynchronous signal requesting information, and will then wait for the reply signal containing the requested information. When the request signal reaches its destination the destination process replies with the requested information.

### 1.3 Implementation

The implementation of different asynchronous signals in the VM may vary over time, but the behaviour will always respect this concept of asynchronous signals being passed between entities as described above.

By inspecting the implementation you might notice that some specific signal actually gives a stricter guarantee than described above. It is of vital importance that such knowledge about the implementation is not used by Erlang code, since the implementation might change at any time without prior notice.

Some example of major implementation changes:

- As of ERTS version 5.5.2 exit signals to processes are truly asynchronously delivered.
- As of ERTS version 5.10 all signals from processes to ports are truly asynchronously delivered.