tadasajon

tadasajon

How is OTP distinct from the BEAM?

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?

Most Liked

lpil

lpil

Creator of Gleam

I would say that the Erlang standard library is the standard library. OTP is an application framework that also is included in the Erlang distribution, and you could choose not to use it if you like.

Although perhaps unhelpfully OTP seems to also the name of the distribution, or at least it is the name of the code repository.

AstonJ

AstonJ

This thread is worth a read re OTP :023:

dimitarvp

dimitarvp

BEAM is the runtime for Erlang, like the JVM is a runtime for for Java, and like CLR is for C#.

OTP is a library written in Erlang. When ran, it runs inside the BEAM, like all other Erlang code.

Where Next?

Popular in Discussions Top

arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
andre1sk
A big advantage to Elixir is all the distributed goodness but for many applications running on multiple nodes having integrated Etcd, Zoo...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18272 126
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
IVR
Hi all, I’ve seen a number of related threads in the past, but I’d still be very curious to hear an up-to-date opinion on this topic. I...
New
rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
RudManusachi
What configs will make sense to put to runtime.exs? – A bit of how I configure apps: I have generic configs in config/config.exs, dev...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36432 110
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement