Re: [plt-scheme] “Multi-threaded” Scheme…

From: Noel Welsh (noelwelsh at
Date: Thu Jun 14 05:08:10 EDT 2007

On 6/13/07, Grant Rettke <grettke at> wrote:
> Seemingly thanks to Erlang there is a lot of hype about programming
> languages that make multi-threaded programming "easy". Not to let ACM
> off the hook either for their frequent FUD blasts regarding the
> imminent failure of the IT world if it can't make multi-threaded
> programming easy. Whatever the case, it seems like there are a number
> of interesting topics and opportunities regarding this topic.
> Thinking about Scheme, and how to write multi-threaded code, is there
> a simple approach, for example, that one could take by writing a
> program that forked off different units of work to new Scheme machines
> and waited for all of their results?

It's important to distinguish between concurrency and parallelism.
Concurrency deals with two or more actions that *conceptually* take
place at the same time, though the actual implementation may be serial
(as happens when running on a single CPU).  Parallelism deals with
performance gains realised from executing multiple actions at the same
time (e.g. using a multicore CPU) though conceptually they might be
written as a serial program (as when a vectorising compiler optimises
a matrix computation).

MzScheme has good support for concurrency using a message passing
paradigm (similar to Erlang) but its runtime prevents it from
exploiting parallelism.  You could exploit parallelism by changing the
runtime, or, as you suggest, forking communicating processes.

It's also worth being aware of the software transactional memory (STM)
approach to concurrency.  In practice you need both -- witness Erlang
(message passing) comes with Mnesia (essentially STM).


Posted on the users mailing list.