p48-larson

p48-larson - 48 COMMUNICATIONS OF THE ACM | MARCH 2009 |...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 48 COMMUNICATIONS OF THE ACM | MARCH 2009 | VOL. 52 | NO. 3 practice easy to reason about the behavior of programs (though there are limits to how easy this can ever be). The implementation makes the ˲ simple primitives fast and scalable, and makes effective use of modern multicore hardware, eliminating the need for more complex mechanisms. The execution model eliminates ˲ some classes of errors from unsynchro- nized access to shared state—or at least makes these errors more noticeable. The model of concurrency is nat- ˲ ural to think about and requires no mathematical sophistication. The environment makes failures ˲ detectable and recoverable, making it possible to deploy a less-than-perfect system in the field that can nonethe- less maintain high availability. The concurrency model maps nat- ˲ urally to distributed deployments. This article introduces the Erlang language and shows how it can be used in practice to implement concurrent programs correctly and quickly. Sequential Erlang Erlang is built from a small number of sequential programming types and concepts, and an even smaller num- ber of concurrent programming types and concepts. Those who want a full introduction can find several excellent tutorials on the Web, b but the following examples (required by functional pro- gramming union regulations) should convey the essentials. As shown in Figure 1A, every file of Erlang code is a module. Declara- tions within the file name the module (which must match the filename) and declare which functions can be called from other modules. Comments run from the percent sign (%) to the end of the line. Factorial is implemented by two functions. Both are named facto- rial , but they have different numbers of arguments; hence, they are distinct. The definition of factorial/2 (the b See Erlang course www.erlang.org/download/ armstrong_thesis_2003.pdf. Erlang is a language developed to let mere mortals write, test, deploy, and debug fault-tolerant concurrent software. a Developed at the Swedish telecom company Ericsson in the late 1980s, it started as a platform for developing soft real-time software for managing phone switches. 1 It has since been open sourced and ported to several common platforms, finding a natural fit not only in distributed Internet server applications, but also in graphical user interfaces and ordinary batch applications. Erlang’s minimal set of concurrency primitives, together with its rich and well-used libraries, give guidance to anyone trying to design a concurrent program. Erlang provides an effective platform for concurrent programming for the following reasons: The language, the standard libraries (Open ˲ Telecom Platform, or OTP), and the tools have been designed from ground up for supporting concurrency....
View Full Document

This note was uploaded on 12/31/2011 for the course CSC 7101 taught by Professor Baumgartner,g during the Spring '08 term at LSU.

Page1 / 9

p48-larson - 48 COMMUNICATIONS OF THE ACM | MARCH 2009 |...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online