The hardware we rely on is changing rapidly asever-faster chips are replaced by ever-increasing numbers of cores. Asa result, concurrency and parallelism, niche features today, will soonbe a basic requirement for most software. Application developersseeking concurrency solutions have discovered that shared-stateconcurrency (employed by Java and other imperative languages) comes upshort when compared to functional models that promise betterreliability and scalability. In this two-part article Alex Millerintroduces the actor concurrency model, which has been popularized byErlang and more recently adopted by Scala. In Part 1 you'll beintroduced to the actor model and its benefits; in Part 2 you'll learnhow to use it on the JVM. Level: Intermediate
Asprogrammers we know that our software lives on top of hardware, whichfor decades has relied on chips getting faster at an unrelenting pace.Moore's Law famously states that the number of transistors on a chipwill double approximately every 18 months. This exponential law hasheld true for nearly four decades. and has even exceeded that pace.Intel chips had a few thousand transistors in the early 1970s. The chipin the computer you're reading this article with probably has hundredsof millions of transistors, and newer quad-core chips have severalbillion.
Until recently,the increase in chip counts (and reduction in size) has made chipsfaster, increased the number of pipelines, and dramatically increasedthe number and size of on-chip caches. But hardware crossed a boundaryin the early 2000s: chips got big enough and cycle speed got fastenough that a signal can no longer reach the whole chip in a clockcycle -- a physical and architectural limit that will be difficult tobreach. Yet the transistors per chip continue their unrelentingexponential march. Instead of increased speed per core, we are nowseeing an increase in the number of cores per chip. CPU speeds arelikely to stay relatively flat or possibly even decrease in the nearfuture in the service of reduced heat and power consumption (see Figure1). The multicore era is well under way, and it will change the way we write programs -- a reality that many software developers have yet to face.
[img=349,196]http://www.javaworld.com/javaworld/jw-02-2009/images/actors1-graph_thumb.jpg[/img]
Figure 1. Transistor and MIPS (millions of instructions per second) trends over time. Click to enlarge. Rightnow you probably use a dual-core machine for day-to-day work, or maybea quad-core if you're lucky. You might be deploying your serverapplication to an 8-core machine. The concurrency model that mostpopular languages use now -- shared-state concurrency -- can make gooduse of multiple cores and result in fast and efficient software. But ifthe number of cores doubles every 18 months, in a decade we will bedealing with thousands of cores. (This seems ridiculous, butexponential curves always seem ridiculous to our feeble wetware. Fortyyears ago, the growth in transistor count to today's levels seemedridiculous and unsustainable.) The prospect of multicore systems ofthis magnitude threatens the viability of the shared-state concurrencymodel. This article introduces you to a robust alternative -- the actorconcurrency model -- and explains how it is implemented in a20+-year-old yet increasingly relevant functional language: Erlang.