Homepage
 
Search
Erlang 
Erlang
Overview

Erlang is a general-purpose programming language and runtime environment with built-in support for concurrency, distribution, fault tolerance and incremental code loading.

It is specifically designed with parallel, distributed and robust control systems in mind. It is used in several Ericsson telecom infrastructure products. Erlang is available for a wide range of operating systems including Solaris, Linux, Mac OS X and Windows.


Erlang was created by the Computer Science Laboratory at Ellemtel (now Ericsson AB) around 1990. It originates from an attempt to find the most suitable programming language for telecom applications. Characteristics for such an application include:
  • Concurrency - Several thousand events, such as phone calls, happening simultaneously.
  • Robustness - An error in one part of the application must be caught and handled so that it does not interrupt other parts of the applications. Preferably, there should be no errors at all.
  • Distribution - The system must be distributed over several computers, either due to the inherent nature of the application, or for robustness or efficiency.

Although most of the languages investigated had many suitable features, they all also had drawbacks. Erlang was to combine the good features of these languages into one. It has a process concept for supporting massive concurrency. Each process has its own memory, which grows and shrinks dynamically. Communication with other processes is achieved by sending and receiving messages. A built-in error-detection mechanism makes it possible to catch errors within and between processes and to restart faulty parts of a program. It is also possible to update code for a running process. Erlang programs can be run on a single node or distributed over several.
Virtual Machine
Like Java, Erlang code is compiled into a byte code that is interpreted by a virtual machine. This makes the Erlang code platform-independent. Only the run-time system must be ported for the program to run on another kind of host. It also makes it possible to run different parts of a distributed system on completely different kinds of hardware.

An important difference between Java and Erlang, however, is that Erlang is a functional, high-level language. The Erlang features and characteristics, and the virtual machine concept, make it useful for complex control system with soft real-time constraints, which is exactly what it was designed for.
Openness
A programming language is not enough, however. Short time-to-market and openness to sourced hardware and software are critical aspects in today's product development. That was why OTP was created in 1996.

OTP stands for Open Telecom Platform, but is more accurately described as middleware aimed at efficient development of competitive control systems of which telecom applications is one example. OTP consists of an Erlang run-time system, a number of ready-to-use components and a set of design principles for Erlang programs. Since Erlang is the basis of OTP, the term Erlang/OTP is normally used instead of just OTP.

OTP can be said to be open in three different ways: different hardware/operating systems due to the platform independence; programs written in other languages due to the built-in interoperability mechanisms; and different protocols due to components providing support for HTTP, SNMP, IIOP, FTP, TCP/IP and more.

Erlang/OTP architecture
Design patterns
When developing a product using Erlang/OTP, the idea is to view the system as a number of services. These could be a database for storing telephone numbers or handling call-control signaling.
The OTP design patterns give a standard way to implement each such service as a self-contained application. The system is then put together by choosing the OTP components needed and adding the user-defined applications. Applications share a common management interface that makes it possible to generate scripts for system start-up and in-service code replacement. Normally, each application is a tree-like process hierarchy with a predefined error detection scheme. The processes are implemented using behaviors, which are formalizations of design patterns with built-in support for error handling, tracing and code replacement.
OTP components
Examples of important components are:
  • Mnesia - a distributed database management system, appropriate for telecommunications applications and other Erlang applications that require continuous operation and exhibit soft real-time properties.
  • Orber - an Erlang implementation of a CORBA object request broker.
  • SNMP - a SNMPv2 and v3 -extensible agent and manager, featuring a MIB compiler and facilities for implementing SNMP MIBs.
  • Web server with support for dynamic content.

There are also components for interfacing and communication, including an IDL compiler, low-level C and Java interfaces.

Related links