Why do OS not support erlang's lightweight process?

Tony Finch <>
Tue Aug 29 15:47:38 CEST 2006


On Tue, 29 Aug 2006, lang er wrote:

> If OS support erlang's lightweight  process in kernel,  many programming
> languages could have  erlang's concurrent capability.I think it is not
> impossible.

The reason that Erlang processes are lightweight is that they do not
require a context switch from userland -> kernel -> userland in order to
schedule the next thread. Erlang can rely on the properties of the
language, specifically no shared mutable data, in order to isolate
processes from each other. The kernel must use the CPU's virtual memory
support to do this, because it cannot make assumptions about the languages
used to write userland processes, and switching pages tables is expensive.

There have been some experiments with single-address-space operating
systems, which should in principle be able to context switch faster (they
only need to change the page table access rights, not the virtual -> real
address mapping) but current CPUs are not optimised for this kind of
design, so it isn't an advantage in practice. It also requires a 64 bit
address space to be practical.

Tony.
-- 
f.a.n.finch  <>  http://dotat.at/
FISHER: WEST OR NORTHWEST 4 OR 5 BECOMING VARIABLE 3 OR 4. FAIR. MODERATE OR
GOOD.



More information about the erlang-questions mailing list