I don't know what sort of system nor erlang you use but on my dual-core Linux laptop your countdown use only one core as expected.<br><br>vmstat: (see 51 user and 49 idle CPU in last rows)<br><br>procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----<br>
r b swpd free buff cache si so bi bo in cs us sy id wa<br> 1 0 0 1503332 29180 252236 0 0 0 0 393 1044 1 0 99 0<br> 1 0 0 1503332 29180 252236 0 0 0 0 432 1117 1 1 98 0<br>
1 0 0 1503380 29180 252236 0 0 0 0 434 2035 1 1 97 0<br> 0 0 0 1503380 29180 252236 0 0 0 0 370 939 0 0 99 0<br> 0 0 0 1503380 29180 252236 0 0 0 0 386 955 0 0 100 0<br>
0 0 0 1503380 29180 252236 0 0 0 0 395 1046 1 0 99 0<br> 0 0 0 1503380 29180 252236 0 0 0 0 481 1729 4 1 95 0<br> 0 0 0 1503380 29180 252236 0 0 0 0 411 1118 4 1 95 0<br>
0 0 0 1503396 29184 252236 0 0 0 52 440 1101 2 1 97 0<br> 0 0 0 1503396 29184 252236 0 0 0 0 362 912 1 0 99 0<br> 0 0 0 1503428 29184 252236 0 0 0 0 387 936 2 1 97 0<br>
0 0 0 1503428 29184 252236 0 0 0 0 390 962 1 0 98 0<br> 0 0 0 1503444 29184 252236 0 0 0 0 392 920 3 1 96 0<br> 1 0 0 1503444 29192 252228 0 0 0 236 482 962 30 1 69 0<br>
1 0 0 1503476 29192 252236 0 0 0 0 502 1112 54 1 46 0<br> 1 0 0 1503476 29192 252236 0 0 0 0 483 765 54 0 47 0<br> 1 0 0 1503476 29192 252236 0 0 0 0 500 784 54 0 46 0<br>
1 0 0 1503476 29192 252236 0 0 0 0 467 738 53 1 46 0<br> 1 0 0 1503476 29192 252236 0 0 0 4 558 1083 53 1 46 0<br> 1 0 0 1503476 29200 252236 0 0 0 56 514 930 51 1 49 0<br>
1 0 0 1503484 29200 252236 0 0 0 0 532 936 51 0 49 0<br> 3 0 0 1503484 29200 252236 0 0 0 0 536 1016 51 1 49 0<br> 1 0 0 1503516 29200 252236 0 0 0 0 553 1023 51 1 49 0<br>
<br><br><div class="gmail_quote">On Tue, Mar 11, 2008 at 12:53 PM, Convey Christian J NPRI <<a href="mailto:ConveyCJ@npt.nuwc.navy.mil">ConveyCJ@npt.nuwc.navy.mil</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could someone clear this up for me please?<br>
<br>
When I run a simple, single-process Erlang function from the erl shell, I light up both CPU cores on my computer. So...<br>
<br>
* How does a single process light up two cores? Is one core busy with garbage collection or something?<br>
* If I can light up two cores with just a simple invocation of the erl shell, then why does the "-smp +S n" option exist?<br>
<br>
Thanks,<br>
Christian<br>
<br>
BTW, here's the code I ran:<br>
<br>
<br>
countdown(X) -> countdown(X, 0).<br>
<br>
countdown(0, Acc) -><br>
Acc<br>
;<br>
countdown(X, Acc) -><br>
countdown(X-1, Acc+1)<br>
.<br>
<br>
countdown(50000000).<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><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil