2

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?

MarJamRob
  • 3,177
  • 6
  • 20
  • 31
Gmp
  • 179
  • 9

1 Answers1

4

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.

Zed
  • 53,338
  • 7
  • 71
  • 100
  • I'm a little confused. If I run erlang on a single core can use to simulate other quantities smp core? For example if you run in single core 4 core simulating the time spent is the same as running straight into a 4 core? You can do this test? – Gmp Nov 08 '10 at 14:35
  • Each scheduler is a separate OS process, and by default one is started for each core. Running multiple schedulers is possible nevertheless, but of course this will not make your computer any "faster". A single core machine is a special case, because if you build a VM without SMP, it might be a bit tweaked compared to SMP enabled machines (because of using less locks). – Zed Nov 08 '10 at 14:41