[erlang-questions] smp not working

Oscar Hellström oscar@REDACTED
Tue May 12 22:33:06 CEST 2009


Hi,

I guess that all of this depends on the program you're running. If your 
program needs to synchronise between processes you will never get 100% 
of all CPUs/cores. There are also other reasons why you wouldn't be able 
to use 100% of all cores such as memory pool locks, ETS table access etc.

You could try something as simple as this:
spawn(fun() -> F = fun(F) -> F(F) end, F(F) end).

Run four of those and see how much CPU you're using.

Erickson, John wrote:
> Hello, I am running erl with -smp enable and it appears to start 4 
> schedulers.  However, I am not seeing all 4 cores used when I watch cpu 
> usage via top.
> 
>  
> 
> When I run erl I get this:
> 
>  
> 
> Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:4] 
> [async-threads:0] [hipe] [kernel-poll:false]
> 
>  
> 
> Also, if I run taskset it seems to show all cores enabled for erl:
> 
>  
> 
> rrciv10736> taskset -p 20937
> 
> pid 20937's current affinity mask: f
> 
>  
> 
> I guess I'm missing something simple?  My program is running 4x (or 
> more) threads per cpu and runs across a small cluster fine.  I thought 
> it would be as easy as turning this flag on to enable more cpus.  Am I 
> wrong?
> 
>  
> 
> John
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

Best regards
-- 
Oscar Hellström, oscar@REDACTED
Office: +44 20 7655 0337
Mobile: +44 798 45 44 773
Erlang Training and Consulting Ltd
http://www.erlang-consulting.com/



More information about the erlang-questions mailing list