Wednesday, August 15, 2007

Erlang: The Programming Language for Multicore CPUs

The future of computing is going to be concurrent. Sun has just announced the UltraSPARC T2 CPU which they call the World's fastest microprocessor. With 8 cores and 64 threads it makes a true system on a chip. Even desktop systems have multi-core processors nowadays. However traditional software is not well prepared to effectively utilize large number of cores.

Concurrent programming is hard. Most programming languages do not make it easier either. On the other hand Erlang is ideally positioned for this new world. It was designed from the ground up to take advantage of parallel and multi-core architectures.

Erlang is a concurrent functional programming language and runtime system. It was designed to support distributed, fault-tolerant, soft-real-time, non-stop applications. Erlang was originally a proprietary language within Ericsson, but was released as open source in 1998.

Erlang programs usually scale very well on multi-core systems. Joe Armstrong explains why:

"Back in the old days (20 odd years ago) there were two models of concurrency:
  • Shared state concurrency
  • Message passing concurrency
Now the whole world went one way (towards shared state), and we went the other"

The Erlang concurrency model differs from other languages by not having any shared state. If a process wants to communicate with another, it does so by sending messages. This method scales better than methods that uses shared memory for communication.

You can learn much more about Erlang in Joe Armstrong's new book:
Programming Erlang: Software for a Concurrent World

It's very readable and does not require prior experience with functional languages. The book is packed with examples and encourages experimenting; in fact the first chapter explains the installation of Erlang. A reviewer calls it "the most important programming language book this decade".

To have some fun check out this article and video from 1990: Erlang Now!


More resources:

No comments: