I am going to try to state my understanding of the distinction between OTP and the BEAM here below. Please comment if you think I got anything wrong, glossed over something important, or missed some aspect of either one.
Here goes…
The EAM in BEAM stands for “Erlang Abstract Machine”, so the BEAM is is just a virtual machine for executing erlang code, which compiles into BEAM-byte-code. So the BEAM is analogous to the JVM, if you’re familiar with the Java world: it is a virtual layer between the programming paradigm and the underlying hardware.
The BEAM is is an actual executable program that has to be installed on a physical machine and fired up. Once it is running, the BEAM is fed BEAM-byte-code, which is what Erlang and Elixir programs compile into, and the BEAM then translates this byte-code into machine-executable-code which the underlying hardware then executes.
OTP, on the other hand, is a set of behaviors, which are implemented in a library that has been installed on top of the BEAM. OTP is basically API contracts for writing software according to well-tested software architecture principles for working with a purely functional language in an environment in which processes are isolated and cheap and message passing is the only means of process communication – which is the architecture enforced by the BEAM.
So BEAM is the abstract machine which enforces a set of rules, and OTP is a set of principles for best executing code and writing software according to the rules enforced by the BEAM.
I guess my only question is: which one of these is more stable and how often do they change? I’ve noticed that asdf
gives the following output in response to the command asdf list all elixir
:
1.13.4
1.13.4-otp-22
1.13.4-otp-23
1.13.4-otp-24
1.13.4-otp-25
1.14.0-rc.0
1.14.0-rc.0-otp-23
1.14.0-rc.0-otp-24
1.14.0-rc.0-otp-25
So I guess OTP is constantly being updated, perhaps in response to incremental updates made to the BEAM.
Also, I guess the actual BEAM executable code is packaged with erlang
, which has to be installed as a dependency of elixir
?