Go-to literature for BEAM?

Can someone point out where can I find solid intro into how BEAM works? Even better, is there some material that clearly explains how Erlang code is interpreted by BEAM?

4 Likes

What about this one The BEAM Book (self-published) (free)?

6 Likes

The Erlang blog also has some posts you might find interesting:

Those two are by @bjorng and @jhogberg :003:

I would also recommend Programming Erlang (PragProg) since it’s written by Joe Armstrong, and I think is a great way to get an insight into one of its creator’s overall perspectives.

Edit: just remembered Robert’s: The Erlang Rationale (PDF) which is also worth a look.

5 Likes

I like books, docs, and howtos, etc. I think there should be more docs and howtos personally. I would also add that I think contributing to documentation in Erlang/OTP is one the best ways to help the community and enrich Erlang/OTP.

That said, the source code! That includes the tests. I can not tell you how many times I’ve wondered how something works or didn’t understand a thing and just went looking at source code starting with grepping around to get bearings and then look at test suites, and connect the dots. For some of us, there’s no better way to learn :slight_smile:

6 Likes

I couldn’t agree more.

Reading source code is a great way to become a better programmer. When I started to learn Erlang, I printed out the entire standard library and read it (little by little during several months).

Some applications in Erlang/OTP now contain internal documentation, which documents how things are implemented. One such document that could be of interest is The beam_makeops script, which describes what happens when a BEAM file is loaded. While it does not directly describes how instructions are executed, I think it can provide some useful background information. In particular, the BEAM interpreter is not a byte code interpreter that directly executes the instructions as they are in the BEAM file; the loader can do quite drastic rewriting and optimization of the instructions while loading them.

5 Likes

I particularly recommend reading the lists module, since lists are such fundamental structures in Erlang.

Edit: I belatedly realised this comment is a bit off-topic here and is more suited to the various “Learning Elrang” threads.

3 Likes