[erlang-questions] Newbie question. Joe Armstrong book. Ring benchmark.

Russell Brown <>
Thu Sep 25 11:26:53 CEST 2008


Hi,
I've just done the "ring benchmark" from the end of Chapter 8 in the  
Joe Armstrong book (Programming Erlang: Software for a Concurrent  
World).

I think I have a module that does what is asked in the problem  
"(Write a ring benchmark. Create N processes in a ring. Send a  
message round the ring M times so that a total of N * M messages get  
sent. Time how long this takes for different values of N and M.)"

I am certain it is nowhere near the best or most elegant way to do it  
as I am not very accomplished (but I do like to have a go anyway).  
What I am wondering is why, when I run the "benchmark" only one of  
the cores on my laptop's dual core seems to get used. Have I written  
it wrong (so that there is no concurrency) or is a ring by its nature  
a sequential thing?

I have attached the code in case it helps answer the above question.   
As I say I am a total newb. My reason for posting is just to verify  
that the implementation works and to find out why it only uses one core.

Also, is there a canonical implementation that beginners like me can  
have a look at?

Many thanks in advance

Russell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080925/6b7e81f6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ring.erl
Type: application/octet-stream
Size: 1700 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080925/6b7e81f6/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080925/6b7e81f6/attachment-0001.html>


More information about the erlang-questions mailing list