Erlang is a functional programming language which also has a runtime environment. It was built in such a way that it had integrated support for concurrency, distribution and fault tolerance. Erlang was originally developed to be used in several large telecommunication systems from Ericsson. he term Erlang is used interchangeably with Erlang/OTP, or Open Telecom Platform (OTP), which consists of the Erlang runtime system, several ready-to-use components (OTP) mainly written in Erlang, and a set of design principles for Erlang programs
History:
The first version of Erlang was developed by Joe Armstrong, Robert Virding and Mike Williams in 1986. It was originally a proprietary language within Ericsson. It was later released as an open source language in year 1998. Erlang, along with OTP, a collection of middleware and libraries in Erlang, are now supported and maintained by the OTP product unit at Ericsson and widely referred to as Erlang/OTP.
Erlang was designed with the aim of improving the development of telephony applications. In 1992, work began on the BEAM virtual machine (VM) which compiles Erlang to C using a mix of natively compiled code and threaded code to strike a balance between performance and disk space. According to Armstrong, the language went from lab product to real applications following the collapse of the next-generation AXE telephone exchange named AXE-N in 1995. As a result, Erlang was chosen for the next asynchronous transfer mode (ATM) exchange AXD
Installation
To download Erlang, one must go to the following url − www.erlang.org/downloads.
This page has a variety of downloads and also the steps required to download and install the language on Linux and Mac platforms.
Click on the ‘OTP 18.3 Windows 32-bit Binary File’ to begin the download of the Erlang Windows Installation file.
The following steps detail how Erlang can be installed on Windows −
Step 1 − Launch the Installer downloaded in the earlier section. After the installer starts, click Run.
Step 2 − Click Next on the following screen to accept the default components, which will be installed.
Step 3 − Accept the default installation path and click Next.
Step 4 − Accept the default Start Menu item, which will be created and click Next.
Step 5 − After the installation is complete, click Close to complete the installation.
Syntax:
let’s first look at a simple Hello World program.
% hello world program
-module(helloworld).-export([start/0]).
start() ->
io:fwrite("Hello, world!\n").
Output:
Hello, world!
Applications:
Erlang is basically used for Distributed, Reliable and Soft Real time Concurrent Systems. Below are some of the application of Erlang where it is used:
Telecommunication systems, e.g. controlling a switch or converting protocols.
Servers for Internet applications, e.g. a mail transfer agent, an IMAP-4 server, an HTTP server or a WAP Stack.
Telecommunication applications, e.g. handling mobility in a mobile network or providing unified messaging.
Database applications which require soft real-time behaviour.
Advantages:
Here are the Advantages of Erlang:
Erlang provides a simple and powerful model for error containment and fault tolerance (supervised processes).
Concurrency and message passing are a fundamental to the language. Applications written in Erlang are often composed of hundreds or thousands of lightweight processes. Context switching between Erlang processes is typically one or two orders of magnitude cheaper than switching between threads in a C program.
Writing applications which are made of parts which execute on different machines (i.e. distributed applications) is easy. Erlang's distribution mechanisms are transparent: programs need not be aware that they are distributed.
The OTP libraries provide support for many common problems in networking and telecommunications systems.
The Erlang runtime environment (a virtual machine, much like the Java virtual machine) means that code compiled on one architecture runs anywhere. The runtime system also allows code in a running system to be updated without interrupting the program.
Disadvantages:
People use Erlang for all sorts of surprising things, for instance to communicate with X11 at the protocol level, but, there are some common situations where Erlang is not likely to be the language of choice.
The most common class of 'less suitable' problems is characterised by performance being a prime requirement and constant-factors having a large effect on performance. Typical examples are image processing, signal processing, sorting large volumes of data and low-level protocol termination.
It is characterised by a wide interface to existing C code. A typical example is implementing operating system device drivers.
large systems developed using Erlang make heavy use of C for low-level code, leaving Erlang to manage the parts which tend to be complex in other languages, like controlling systems spread across several machines and implementing complex protocol logic.
Source: Wikipedia
The Tech Platform
Comments