[erlang-questions] How many scheduler threads to I need?

Hynek Vychodil vychodil.hynek@REDACTED
Tue Mar 11 13:42:53 CET 2008


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.

vmstat: (see 51 user and 49 idle CPU in last rows)

procs -----------memory---------- ---swap-- -----io---- -system--
----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id
wa
 1  0      0 1503332  29180 252236    0    0     0     0  393 1044  1  0 99
0
 1  0      0 1503332  29180 252236    0    0     0     0  432 1117  1  1 98
0
 1  0      0 1503380  29180 252236    0    0     0     0  434 2035  1  1 97
0
 0  0      0 1503380  29180 252236    0    0     0     0  370  939  0  0 99
0
 0  0      0 1503380  29180 252236    0    0     0     0  386  955  0  0
100  0
 0  0      0 1503380  29180 252236    0    0     0     0  395 1046  1  0 99
0
 0  0      0 1503380  29180 252236    0    0     0     0  481 1729  4  1 95
0
 0  0      0 1503380  29180 252236    0    0     0     0  411 1118  4  1 95
0
 0  0      0 1503396  29184 252236    0    0     0    52  440 1101  2  1 97
0
 0  0      0 1503396  29184 252236    0    0     0     0  362  912  1  0 99
0
 0  0      0 1503428  29184 252236    0    0     0     0  387  936  2  1 97
0
 0  0      0 1503428  29184 252236    0    0     0     0  390  962  1  0 98
0
 0  0      0 1503444  29184 252236    0    0     0     0  392  920  3  1 96
0
 1  0      0 1503444  29192 252228    0    0     0   236  482  962 30  1 69
0
 1  0      0 1503476  29192 252236    0    0     0     0  502 1112 54  1 46
0
 1  0      0 1503476  29192 252236    0    0     0     0  483  765 54  0 47
0
 1  0      0 1503476  29192 252236    0    0     0     0  500  784 54  0 46
0
 1  0      0 1503476  29192 252236    0    0     0     0  467  738 53  1 46
0
 1  0      0 1503476  29192 252236    0    0     0     4  558 1083 53  1 46
0
 1  0      0 1503476  29200 252236    0    0     0    56  514  930 51  1 49
0
 1  0      0 1503484  29200 252236    0    0     0     0  532  936 51  0 49
0
 3  0      0 1503484  29200 252236    0    0     0     0  536 1016 51  1 49
0
 1  0      0 1503516  29200 252236    0    0     0     0  553 1023 51  1 49
0


On Tue, Mar 11, 2008 at 12:53 PM, Convey Christian J NPRI <
ConveyCJ@REDACTED> wrote:

> Could someone clear this up for me please?
>
> When I run a simple, single-process Erlang function from the erl shell, I
> light up both CPU cores on my computer. So...
>
> * How does a single process light up two cores?  Is one core busy with
> garbage collection or something?
> * 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?
>
> Thanks,
> Christian
>
> BTW, here's the code I ran:
>
>
> countdown(X) -> countdown(X, 0).
>
> countdown(0, Acc) ->
>   Acc
> ;
> countdown(X, Acc) ->
>   countdown(X-1, Acc+1)
> .
>
> countdown(50000000).
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080311/85bf8450/attachment.htm>


More information about the erlang-questions mailing list