[erlang-questions] how are erlang process lightweight?

Gordon Guthrie <>
Tue Oct 3 15:23:14 CEST 2006


Ben

> So to sum up, from an implementation of Erlang processes point of view,
> Erlang processes are _very_ similar to threads apart from:

Well on pre-R11 Erlang bear in mind that they all run inside a single
operating system thread...

> 	- each process/thread has it's own memory space which is never shared
> with others, and they communicate via message passing.

They communicate by message passing ONLY which means there is no overhead
for suspended processes (ie processes in receive-> ) as they can only be
'awakened' by another process (or timed out by the runtime)

> 	- the mechanics of the process/thread is not handled by the OS outside
> user space, but by the Erlang runtime system in user space -- inside
> the programme's process(that use of "process" being the normal unix
> one).

Yes, but the programme's THREAD as above...

> And the savings of doing all the switching etc. in user space is a main
> reason Erlang processes can be so lightweight. That, and also the loss
> of the need for locks etc.

Gordon



More information about the erlang-questions mailing list