Erlang Central

A Guide To The Erlang Source

Revision as of 20:08, 19 August 2009 by Zghst (Talk | contribs)

A guide to the erlang source.



The source can be downloaded from: or


Most of the interesting code is in: erts/emulator/beam


The atoms used in erlang are listed in erts/emulator/beam/atom.names and are referenced in the code as am_foo. So the 'EXIT' atom is am_EXIT in the code.


Most used types are: Sint, Uint, Eterm, ... Conversion is done in erts/emulator/beam/big.c. For example uint_to_big(Uint x, Eterm *y). term_to_Uint(Eterm term, Uint *up)


The process struct is defined in erts/emulator/beam/process.h. The important function is Process *schedule(Process *p, int calls) in process.c . The next process is picked in "pick_next_process" of that method.

Monitors and links

See erl_monitor.c and .h. The main structs are ErtsLinks and ErtsMonitor. Each process has a *ErtLinks and *ErtsMonitor (herein all its links/monitors are kept as an AVL tree). Actions are done with erts_sweep_links(ErtsLink *root, ...) and erts_sweep_monitors(ErtsMonitor *root, ...).