<div dir="ltr">How are you running the program? You have to explicitly tell the compiler/interpreter to use multiple system threads.<br><br>Michael<br><br><div class="gmail_quote">On Tue, May 5, 2009 at 10:19 PM, Jack Kennedy <span dir="ltr">&lt;<a href="mailto:jack@realmode.com">jack@realmode.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>In step 4 of Haskell in 5 Steps [<a href="http://haskell.org/haskellwiki/Haskell_in_5_steps" target="_blank">http://haskell.org/haskellwiki/Haskell_in_5_steps</a>],</div>
<div>a parallel program is given. I changed it very slightly so it would run a long time (see below).</div>
<div><br></div><div>It compiles and runs but my CPU meter is barely above 50%.  I have a dual core processor.</div><div>What in the world would keep this program from completely saturating the CPU?</div><div><br></div><div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">import Control.Parallel</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;"> </span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">main = a `par` b `pseq` print (a + b)</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">    where</span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">        a = ack 4 10</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">        b = ack 4 10</span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;"> </span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">fac 0 = 1</span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">fac n = n * fac (n-1)</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;"> </span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">ack 0 n = n+1</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">ack m 0 = ack (m-1) 1</span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">ack m n = ack (m-1) (ack m (n-1))</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;"> </span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">fib 0 = 0</span></span></div><div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">fib 1 = 1</span></span></div>

<div><span style="font-family: &#39;courier new&#39;,monospace;"><span style="font-size: large;">fib n = fib (n-1) + fib (n-2)</span></span></div><div><br></div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>