[erlang-questions] SMP support in OpenBSD

Wallentin Dahlberg wallentin.dahlberg@REDACTED
Sat Aug 8 01:24:56 CEST 2009


Rapid spawning of a serious amount of processes has an internal bottleneck
(a lock congestion) in erts and is even more apparent in short lived
processes (the latter is not the case here though). An infinite loop which
purpose only is spawning new processes will serialize your runtime
environment.

It is considered good parallelizing practice to spawn a number of worker
processes equal to the number of logical processing elements in your system,
in your case four. In some cases it could be helpful to have a set of
pre-spawned worker processes that you have in a work pool.

The Rapid spawning serialization problem is known to us and the problem will
be mitigated in a future release of Erlang/OTP.

Try using a finite number of processes say between 4 and 256 and see if your
cpu-utilization increases.

Regards,
Björn-Egil
Erlang/OTP

2009/8/7 Nikolay Epifanov <nik.epifanov@REDACTED>

> 2009/8/7 Rapsey <rapsey@REDACTED>
>
> > What is the test program?
> >
>
> Here it is:
>
> --------------------------------
> -module(bsd_test).
> -compile(export_all).
>
> p(X, Y) ->
>    p(X, X, Y).
>
> p(X, _, 1) ->
>    X;
> p(X, Z, Y) ->
>    p(X * Z, Z, Y-1).
>
> run() ->
>    spawn(fun() -> p(999, 999999) end),
>    run().
> --------------------------------
>
> Is it ok?
>


More information about the erlang-questions mailing list