Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Programming Erlang


Joe Armstrong had fault tolerance in mind when he designed and implemented the Erlang programming language in 1986, and he was subsequently the chief software architect of the project which produced Erlang/OTP, a development environment for building distributed real-time high-availability systems. More recently Joe wrote Programming Erlang: Software for a Concurrent World. He currently works for Ericsson AB where he uses Erlang to build highly fault-tolerant switching systems.

DDJ: Joe, what's unique about Erlang as a language? Why do we need a language like it?

JA: Erlang is a concurrent functional programming language. Basically there are two models of concurrency:

  • Shared state concurrency
  • Message passing concurrency

Virtually all language use shared state concurrency. This is very difficult and leads to terrible problems when you handle failure and scale up the system.

Erlang uses pure message passing concurrency. Very few languages do this. Making things scalable and fault-tolerant is relatively easy.

Erlang is built on the ideas of:

  • Share nothing. (Process cannot share data in any way. Actually, this is not 100% true; there are some small exceptions.)
  • Pure message passing. (Copy all data you need in the messages, no dangling pointers.)
  • Crash detection and recovery. (Things will crash, so the best thing to do is let them crash and recover afterwards.)

Erlang processes are very lightweight (lighter than threads) and the Erlang system supports hundreds of thousands of processes.

It was designed to build highly fault-tolerant systems. Ericsson has managed to achieve nine 9's reliability [99.9999999%] using Erlang in a product called the AXD301. [Editor's Note: According to Philip Wadler, the AXD301 has 1.7 million lines of Erlang, making it the largest functional program ever written.]

DDJ: So are programmers really using Erlang in the real world, or is it solely of academic interest?

JA: Absolutely. Commercial use is far greater than academic. It was developed at the Ericsson Computer Science Lab for building fault-tolerant systems. It's used by Ericsson in a number of products.

Outside of Ericsson, Erlang is used by a number of start-ups for building high-performance servers. Most notably ejabberd which is a jabber server. This is probably the best featured and fastest free jabber server on the market, it's being used as a back-end in a lot of products.

Some pretty fast-moving startups in the financial world have latched onto Erlang; for example, the Swedish www.kreditor.se. Erlang gives them a great commercial advantage over their competitors.

DDJ: It seems that, what with multi-core processors and the like, we're rapidly approaching the day of commodity parallelization. When you designed Erlang in the 1980s, did you ever expect parallel systems would be a commodity, or did you see it as primarily a language for high-performance computing only?

JA: It was never a language for high-performance computing. It was a language for building fault-tolerant distributed systems. Ericsson has always used parallel hardware in its switching products -- right from the AXE in the mid 1970s. There is a "school" of parallel programming inside Ericsson. Erlang is the third language in a progression of languages: PLEX -> Eri-Pascal -> Erlang.

The Erlang philosophy was always to build system with lots of cheap processors and allow them to fail. We don't prevent failure; we live with it and recover when failures occur. That's what Erlang was designed to do. That's why there is "no shared state". Shared state and failure are ill-suited bed-fellows.

Today multi-cores are really like "distributed system on a chip" with very high-speed message passing. Since we have share-nothing and concurrency, Erlang programs map beautifully onto multi-cores. Ericsson is shipping products on dual-cores that run virtually twice as fast as the uni-cores with only tiny changes to the code.

DDJ: In addition to your book Programming Erlang, can you point readers to websites where they can find out more about this most interesting programming language?

JA: Yes, there is the Open Source Erlang site at www.erlang.org which, among other things, includes the full source code of the current Erlang system. Then there is the Erlang community site at www.trapexit.org.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.