views:

614

answers:

2

When I start up my Erlang emulator, there the first bit has a bunch of informational things. (Slightly reformatted for effect.)

manoa:~ stu$ erl
Erlang (BEAM) emulator version 5.6.5 
[source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6.5 (abort with ^G)
1>

Some of it I can guess at, probably accurate, but some of it means 'here be magic'.

  • Erlang (BEAM) emulator version 5.6.5: the version, of course
  • [source]: the emulator was compiled from source?
  • [smp:2]: two CPU cores detected and available
  • [async-threads:0]: currently running jobs?
  • [hipe]: ?
  • [kernel-poll:false]: ?

I also wonder if there are other [foo] items that may pop up with different configurations, builds or start up parameters.

So, what do the Erlang emulator info statements mean?

+9  A: 

[async-threads:0]

Size of async thread pool available for loaded drivers to use. This allows blocking syscalls to be performed in a separate kernel thread from the beam vm. Use command switch +A N to adjust the size of the pool.

[hipe]

Support for native compilation of erlang source and bytecode. Tends to mostly be useful for number crunching code. IO-bound code do fine on the bytecode interpreter.

[kernel-poll:false]

There is the old select(2) and poll(2) system calls for receiving notification that some file descriptor is ready for unblocking writing or reading. They do not scale well to high number of open file descriptors. Modern operatingsystems have alternative interfaces, linux has epoll, freebsd has kqueue. Enable with command switch +K true

Christian
+13  A: 

[source]

It means some third party (maybe you, maybe your OS distro's package mantainer, maybe your sysadmin) built Erlang from source. The alternative is downloading an official binary version from Erlang.org.

[smp:2:2]

The [smp:2] tag changed to this format in Erlang R13, meaning 2 schedulers, both of which are online. If you say "erl +S1", it says [smp:1:1] instead. You can take schedulers offline at runtime with erlang:system_flag(schedulers_online, N), where N can be anything between 1 and the number of cores detected, inclusive.

Other tags you can see here:

[rq:2]

Means 2 run queues, a new feature as of R13, allowing Erlang to make better use of multi-core machines. The first SMP-capable versions of Erlang had multiple schedulers (e.g. [smp:2]) but a single shared run queue, which limited scalability.

[64-bit]

The BEAM emulator is built to make full use of a 64-bit CPU.

[hybrid-heap]

Appears if you passed --enable-hybrid-heap to the configure script. It affects how the emulator deals with data shared among multiple processes. The hybrid heap is more complex to manage, but avoids multiple copies of shared data, which can be a net advantage when your program has lots of shared data.

[incremental GC]

Appears if the hybrid heap option is enabled and you have also uncommented the #define INCREMENTAL line in erts/emulator/beam/erl_vm.h. Apparently an experimental feature.

[debug-compiled]

The emulator was built such that it can be run under a native debugger.

[type-assertions]

Appears when you uncomment the ET_DEBUG line in erts/emulator/beam/erl_term.h, enabling runtime checking of all type-specific data accesses. Not enabled by default because it slows down the emulator.

[lock-checking]

Appears if you passed --enable-lock-check to the configure script.

[lock-counting]

Appears if you passed --enable-lock-counter to the configure script.

[purify-compiled]

The emulator was compiled with Purify support.

[valgrind-compiled]

Appears when you build on a platform with Valgrind installed, and the configure script finds valgrind.h.

*(This list comes from erts/emulator/beam/erl_bif_info.c in the Erlang OTP source tree.)*

Warren Young