I didn’t known this was a so popular problem when I coded a sieve of Eratosthene using stream design from SICP.

In fact, I saw this video about NewSqueak which present an example of a concurrent algorithm of the sieve, and in this related discussion on plan9 group I also found an Haskell implementation (more related to the stream design than to the concurrent design IMHO). I also had a look at libtask which offer a C version of the concurrent sieve.

That’s already a lot, so one more shouldn’t be useful … but I like this example, and thus here is my Erlang implementation using a spawn for each prime in the sieve.

Advertisements