ErlCee++

Luke Gorrie <>
Tue Jun 8 12:35:11 CEST 2004


Shawn Pearce <> writes:

> The downside here is that POSIX threads and UNIX processes cost a lot
> more of memory resources and context switch latencies than an Erlang
> process costs.

"I must program as inefficiently as possible."

I wonder what the real CPU/memory costs would be of using Unix
processes instead of Erlang ones? I've heard rumour that Linux/x86 is
making processes and threads lighter-weight all the time.

I find it interesting that in our distributed control system at work
we don't have so terribly many processes:

  ()1> length(processes()).
  209

Compare that with Linux on my laptop:

  $ ps ax | wc -l
      142

Perhaps OS processes are in fact lightweight enough for more than we
tend to assume? Not every program is like Yaws :-)

Joe has often remarked that many of the nice properties of Erlang
processes are shared by Unix processes, chiefly isolation. He flatly
dismisses actually using OS ones just because he's an efficiency nut :-)

I'd really like to see an Erlang-like runtime system built on Unix
processes. How far towards the Erlang programming style could it be
pushed? Wouldn't it be fun to be able to write "Erlang" processes in
any language and mix 'em all together?

Side notes:

  Linux 2.6 does one thousand context-switches per second, spends
  absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1).

  Memory is cheap.

Cheers,
Luke




More information about the erlang-questions mailing list