[erlang-questions] how are erlang process lightweight?

Ben Dougall bend@REDACTED
Tue Oct 3 11:30:40 CEST 2006


Hello,

I'm trying to find out how Erlang processes work / what they're made 
of. I know they don't share their memory with each other (have their 
own heaps), in order to communicate do so by message passing that are 
serialised data. They run one after another, per cpu/core. The 
schedular decides which process should get to go next. They stop 
processing when they come to a point where they're waiting for a 
message or after they've been processing for a certain amount of time. 
All this is handled by the language/runtime system and happens within 
user space.

Each process is very lightweight. I'm struggling to find out how 
they're lightweight. They're stackless? Is that correct? On the stack, 
with things that use them, local variables are stored. What happens to 
a process's local variables when it's switched out of control (due to 
coming to a point where it's waiting for a message or reached its time 
limit)? Each process must have local variables don't they? So what 
happens to them? Where do they get stored? If you have a set of local 
variables per process then how is each process considered so 
lightweight? And if you don't have a set of local variables per process 
then how can they operate reasonably -- local variables persisting seem 
essential? A set of local variables must get stored per process and if 
you have hundreds of thousands of processes that's not so lightweight 
is it?

Also how do processes correspond to functions? Is it just one function 
per process? Processes and functions are very much tied up with each 
other; one to one?

Any info or pointers to things that contain info on this would be much 
appreciated.

Thanks, Ben.




More information about the erlang-questions mailing list