Search code examples
erlangsmp

Using Erlang for testing.


Can I test on a computer with a single core erlang programs for four or more cores?

When starting without using any parameter erlang smp assumes 2:2 like this:

Erlang R14A (erts-5.8) [smp: 2:2] [rq: 2] [async-threads: 0]

I am using a Pentium 4, does that mean I have two cores?


Solution

  • By default one scheduler is started per available core, and multi run-queues are used (one for each scheduler; available since R13). In your shell [smp 2:2] means that you have two schedulers running on two cores; [rq: 2] means you are using two run queues.

    If you want to change the number of schedulers, start with erl +S 4 for four schedulers for example.

    Make sure that if you compile erlang on a single-core system, you enable smp in the configure script using --enable-smp-support. Otherwise you might not be able to use multiple schedulers.