[erlang-questions] Confused about USE_THREADS vs. ERTS_SMP while building

Peer Stritzinger peerst@REDACTED
Mon Apr 16 23:12:07 CEST 2012


Hi,

while porting Erlang to the RTEMS real time os I'm stuck understanding
the meaning of the USE_THREADS vs. ERTS_SMP in beam.

So far it is clear to me that ERTS_SMP implies USE_THREADS.

What is less clear is the usefulness of USE_THREADS without smp.  I
tried building with USE_THREADS and ERTS_SMP not set (RTEMS doesn't
support SMP yet very well):

The build works well but when I try to run it stumbles because of
cpuinfo not set to useful values:

 *cpuinfo = {configured = 0, online = 0, available = 0, topology_size
= 0, topology = 0x0}

This results in the error exit with the message "Failed to set thread
main status: Invalid argument (22)"

The reason for that seems to be that erts_cpu_info_update() in
erl_misc_utils.c can't figure out the right cpu topology for non SMP.
reason is that my OS doesn't have all these fancy sysconf/syctl
whatever calls.

What I don't understand why it is trying to find out about the
topology when ERTS_SMP is not defined?
Shouldn't it just use a default of: "I have just one plain old core"?

Is this a bug?

Or does it only make sense to build the system either with both
ERTS_SMP and USE_THREADS set or with both unset?

Cheers,
-- Peer



More information about the erlang-questions mailing list