[erlang-questions] How many threads does Erlang use?

Convey Christian J NPRI ConveyCJ@REDACTED
Mon Mar 10 15:15:09 CET 2008


I've been experimenting with parallel programming in Erlang, but I'm confused about how many threads Erlang has..

I've got a dual-core Intel x86 processor.  When I run what appears to be a single-threaded Erlang function, and without specifying the -smp option, both cores still seem to light up on my box.  Can anyone explain that to me?

Here's my code, inside z.erl:

countdown(0) ->
   0
;
countdown(X) ->
   1 + countdown(X-1)
.


Then here's what I run on the command line:

cjc@REDACTED:~/z$ erl
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
1> z:countdown(500000000).


And this seems to light up both CPUs, according to my performance monitor.

Thanks,
Christian



More information about the erlang-questions mailing list