From what I understand a virtual machine falls into two categories either "system virtual machine" or a "process virtual machine". It's kind of fuzzy to me where BEAM lies. Is there another kind of virtual machine I am not aware of?
3 Answers
The Erlang VM runs as one OS process. By default it runs one OS thread per core to achieve maximum utilisation of the machine. The number of threads and on which cores they run can be set when the VM is started.
Erlang processes are implemented entirely by the Erlang VM and have no connection to either OS processes or OS threads. So even if you are running an Erlang system of over one million processes it is still only one OS process and one thread per core. So in this sense the Erlang VM is a "process virtual machine" while the Erlang system itself very much behaves like an OS and Erlang processes have very similar properties to OS processes, for example isolation. There is actually an Erlang VM, based on the BEAM, which runs on bare metal and is in fact an OS in its own right, see Erlang on Xen.
By the way, it is perfectly possible to have systems running millions of Erlang processes and it is actually done in some products, for example WhatsApp.
We were definitely thinking very much about OSes when we designed the basic Erlang environment.

- 11
- 4

- 20,848
- 2
- 37
- 56
-
1@rvirding Does this mean that underlying OS does not know anything about the applications/processes running on top of Erlang VM? – Vombat Oct 19 '13 at 09:10
-
7@coffeMug No, from the OS point of view the Erlang VM is a normal OS process just like any other OS process. Like other OS processes it uses resources provided by the OS like memory, i/o devices, etc. So everything specifically Erlang like processes/fault-tolerance/applications/etc is handled inside the Erlang VM process. – rvirding Oct 20 '13 at 18:54
-
1What is the big win with Erlang on Xen - is it just faster? – tadasajon Feb 16 '17 at 23:20
-
1Would it be possible to create a BEAM+OTP 'workalike' environment using standard processes and OS features such as process management (spawn/kill/set limits) and IPC (pipes/sockets)? – Rik Hemsley Mar 02 '17 at 09:08
-
4@RikHemsley Yes, it would be possible but only for very limited applications. Remember having 10k, 100k or even 1M processes in erlang systems is not uncommon so modelling them with OS processes would not be realistic. – rvirding May 10 '17 at 11:09
-
Excellent answer - however, IMHO what it describes is not a *virtual machine*, just an *interpreter*. – peterh Jun 07 '18 at 10:27
Virtual machine is a computing system. The ultimate goal of a computing system is to execute programmed logic. From this perspective, virtual machines can be categorized into 4 types according to the level of abstraction and scope of emulation:
Type 1: Full Instruction Set Architecture (ISA) virtual machine provides a full computer system's ISA emulation or virtualization. Guest operating systems and applications can run on the top of the virtual machine as an actual computer (e.g.,VirtualBox,QEMU,XEN).
Type 2: Application Binary Interface (ABI) virtual machine provides a guest process ABI emulation. Applications against that ABI can run in the process side by side with other processes of native ABI applications (e.g.,Intel's IA-32 Execution Layer on Itanium, Transmeta's Code Morphing for X86 emulation, Apple's Rosetta translation layer for PowerPC emulation).
Type 3: Virtual ISA virtual machine provides a runtime engine so that applications coded in the virtual ISA can execute on it. Virtual ISA usually defines a high level and limited scope of ISA semantics, so it does not require the virtual machine to emulate a full computer system (e.g.,Sun Microsystem's JVM, Microsoft's Common Language Runtime, Parrot Foundation's Parrot virtual machine).
Type 4: Language Virtual Machine provides a runtime engine that executes programs expressed in a guest language. The programs are usually presented to the virtual machine in source form of the guest language, without being fully compiled into machine code beforehand. The runtime engine needs to interpret or translate the program and also fulfill certain functionalities that are abstracted by the language such as memory management (e.g., the runtime engines for Basic, Lisp, Tcl, Ruby).
The boundaries between virtual machine types are not clear-cut. For example, a language virtual machine can also employ the technique of a virtual ISA virtual machine by compiling the program into a kind of virtual ISA and then executing the code on a virtual machine of that virtual ISA.
Many VM designs, such as BEAM, crossing the boundaries. They could be fit into both 3rd and 4th categories.
source:
- Wikipedia
- Advanced Design and Implementation of Virtual Machines; Xlao-Feng LI

- 651
- 5
- 10
-
It's relatively new which is why it doesn't have many upvotes. I upvoted it. – Eric des Courtis Sep 26 '17 at 20:11
-
-
How should JS runtimes like Node.js or web browsers be categorized? Also, does Docker fit anywhere in here? – Jacob Stamm Apr 12 '22 at 14:21
I assume that you've been reading http://en.wikipedia.org/wiki/Virtual_machine - under that terminology, BEAM is a "process virtual machine", just like the JVM.

- 10,412
- 1
- 23
- 24
-
What confuses me there is that it claims that a process virtual machine `runs as a normal application inside a host OS and supports a single process.` But the Erlang VM has many processes running inside it which doesn't fit the description. – Eric des Courtis May 27 '13 at 20:06
-
2System level processes and Erlang processes are not the same. The processes in Erlang terminology are actually user land processes, and the VM itself is a single operating system level process. – kjw0188 May 27 '13 at 20:51
-
With single process they probably use the Unix definition of a process. An Erlang process is a different type of process. – Ward Bekker May 27 '13 at 20:53
-
2@kjw0188 I understand but I don't see any distinction between OS process and language level process. – Eric des Courtis May 27 '13 at 21:41
-
@WardBekker You might be right but but nowhere is it specified. – Eric des Courtis May 27 '13 at 21:42
-
1@EricdesCourtis More background about Erlang processes: http://stackoverflow.com/questions/2708033/technically-why-is-processes-in-erlang-more-efficient-than-os-threads – Ward Bekker May 28 '13 at 06:15
-
1@WardBekker Thanks for the help I understand Erlang processes. I just wasn't sure what type of VM categorie Erlang fell into. – Eric des Courtis May 28 '13 at 16:15
-
2I would be wary of categorizing virtual machines too much. They tend to be unique in what they do. And they are often too different to put into a specific category. – I GIVE CRAP ANSWERS May 29 '13 at 09:50
-
@IGIVECRAPANSWERS You are right but the real question is why does wikipedia do it? – Eric des Courtis May 29 '13 at 12:34
-
@EricdesCourtis Wikipedia does it because the name is heavily overloaded, like many other things in Computer Science. When people speak of Virtual Machines, it is like speaking of Object Orientation: It means different things to different people. So you need some kind of further elaboration to handle this. – I GIVE CRAP ANSWERS May 30 '13 at 09:52
-
@IGIVECRAPANSWERS Sounds to me like people don't really know what they are talking about. But yes you are correct. – Eric des Courtis May 30 '13 at 12:44