[Shootout-list] process creation & message passing
Einar Karttunen
ekarttun@cs.helsinki.fi
Tue, 19 Oct 2004 09:09:15 +0300
On 18.10 12:54, Isaac Gouy wrote:
> > chain
> > - create a chain of 1000 processes/threads/...
> > - destroy the chain of processes/threads/...
> > - repeat n times
> > : print 1000 (show program exited normally)
> > (1 parameter, n: how many create/destroy cycles)
> > scale by increasing number of create/destroy cycles.
>
> Perhaps better described by
>
> chain
> - create a chain of 1000 processes/threads/...
> - repeat n times
> : print 1000 (show program exited normally)
> (1 parameter, n: how many create cycles)
> scale by increasing number of create cycles.
Please make it print n*1000.
chain:
sum := 0
foreach n
sum += create_threads 1000
print sum
create_threads m = tid <- get_my_id
create_loop m tid
val <- receive
return val
create_loop 0 next = send next 0
create_loop m next = tid <- spawn (x <- receive; send next (x+1))
create_loop (m-1) tid
- Einar Karttunen