<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><div><div>On 25 Sep 2008, at 16:06, Edwin Fine wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Russell,<br><br>In general, it's worth searching the erlang archives, which often have the answers to many questions. The searchable archive is at <a href="http://www.erlang.org/faq.html">http://www.erlang.org/faq.html</a>.<br> <br>This post discusses your question. There are quite a few posts in the archives about the ring benchmark.<br><br><a href="http://www.erlang.org/pipermail/erlang-questions/2006-March/019503.html">http://www.erlang.org/pipermail/erlang-questions/2006-March/019503.html</a></div></blockquote><div><br></div><div>Thanks for that. Good resource, should have checked it before, In future I will be sure too. Seems my version is like a few others out there and the answer is: yeah, ring benchmark is not so concurrent.<div><br></div><div>Thanks again. Enjoying this. </div><div><br></div><div>Russell</div></div><br><blockquote type="cite"><div dir="ltr"><br> <br><div class="gmail_quote">2008/9/25 Russell Brown <span dir="ltr"><<a href="mailto:russell.brown@mac.com">russell.brown@mac.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style=""> <font face="'Helvetica Neue'"><span></span><span></span></font></div> <br><div style=""><font face="'Helvetica Neue'"><span></span>Hi,</font><div><font face="'Helvetica Neue'">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). </font></div> <div><font face="'Helvetica Neue'"><br></font></div><div><font face="'Helvetica Neue'">I think I have a module that does what is asked in the problem "<span style="font-family: Helvetica;">(<font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">Write a ring benchmark. Create</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">N</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">processes in a ring. Send a mes<span style="font-family: Helvetica;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">sage round the ring</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">M</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">times so that a total of</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">N * M</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">messages get <span style="font-family: Helvetica;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">sent. Time how long this takes for different values of</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">N</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">and</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font face="'Helvetica Neue'"> </font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">M</font></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><font size="3" face="'Helvetica Neue'">.)"</font></font></span></font></font></span></font></font></span></font></div> <div><font face="'Helvetica Neue'"><br></font></div><div><font face="'Helvetica Neue'">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?</font></div> <div><font face="'Helvetica Neue'"><br></font></div><div><font face="'Helvetica Neue'">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.</font></div> <div><br></div><div>Also, is there a canonical implementation that beginners like me can have a look at?</div><div><font face="'Helvetica Neue'"><br></font></div><div><font face="'Helvetica Neue'">Many thanks in advance</font></div> <div><font face="'Helvetica Neue'"><br></font></div><div><font face="'Helvetica Neue'">Russell</font></div></div><br>_______________________________________________<br> erlang-questions mailing list<br> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div></blockquote></div><br></div></body></html>