Taking the road less traveled to parallel apps via Erlang and Haskell

Print Friendly, PDF & Email

There are lots of ideas flying around the developer community right now as businesses look for ways to capitalize on the gap between the capacity of multicore processors and the capability of developers to create applications that take advantage of that capacity.

Some of the new ideas are old ideas, and in particular I’m seeing a lot of talk about the potential of functional programming. Multicoreinfo.com is picking up on the same vibes, and posts two pointers to articles on these languages

The first, on Erlang, points to an article in the SD Times on the use of the language in the enterprise (including places like Amazon and Yahoo!)

Damien Katz won the Erlanger of the Year award for 2008. He’s the creator of CouchDB, a Lotus Notes-style document database written in Erlang. He said that he rewrote six months’ worth of C++ into Erlang over a month and a half. “It is actually very close to Smalltalk, I think, in terms of the original goals of Smalltalk. But Erlang hides its state within a process, and Smalltalk hides it in an object,” said Katz.

…“They can’t see each other. All they can do is send messages. They can send asynchronous messages, and that’s how you do all of your concurrency. Instead of global data, where you modify it and read it and set a global lock, you send it a message and say, ‘Give me a value for foo,’ or you might send a message like, ‘Increment the bar value.’ You have these processes, and they are self-contained, they have their own memory, and they can die. It’s a very different programming model than the traditional threads model.”

The second post is a pointer to a tutorial by Simon Peyton-Jones of Microsoft Research on parallel programming with Haskell

This practical tutorial introduces the features available in Haskell for writing parallel and concurrent programs. We first describe how to write semi-explicit parallel programs by using annotations to express opportunities for parallelism and to help control the granularity of parallelism for effective execution on modern operating systems and processors. We then describe the mechanisms provided by Haskell for writing explicitly parallel programs with a focus on the use of software transactional memory to help share information between threads.