[Shootout-list] Re: ring of processes

Aaron Denney wnoise@ofb.net
Tue, 5 Oct 2004 01:23:09 +0000 (UTC)


On 2004-10-04, Bengt Kleberg <bengt.kleberg@ericsson.com> wrote:
> i know we are talking about pseudo random, but i still think it would be 
> better with a deterministic sending algorithm.

I agree.

> if we had both ways around the ring, would it, in a haskell program, 
> still be silly to look at the sender?

Well, any static arrangement where processes only send to small numbers
of processes and receive from small numbers can be done by setting up
the topology in the master spawner, and then not having them care at
all.

I'm going to propose a prime number p of processes, the master sends N
messages to each process.  The processes have IDs from 0 (master) to
p-1.  On receipt of message from process m, process i relays it to
(i + (i - m)) mod p.  The master waits for all messages to get back, and then
terminates.  In addition, the messages can contain data saying where
they should come from at the end (p-sender).  A prime number means that
all messages will have to visit all of the processes before getting back
to the original sender.

-- 
Aaron Denney
-><-