Fwd: forwarded message from Christian Tismer (fwd)

Joe Armstrong joe@REDACTED
Tue Apr 22 12:42:53 CEST 2003

  A Stackless Python  context switch may or may not  be faster than an
Erlang context  switch - in  any case I  fail to see why  the question
should be interesting.

  Stackless Python (presumably) allows for an efficient implementation
of Python threads - but  Python threads themselves seem to suffer from
all the usual problems of thread programming -

  Erlang processes  are *independent* (unless you link  them) - Python
threads  share   memory  -  so  you   need  all  the   usual  mess  of
synchronization primitives to get anything  to work and one thread can
happily  corrupt  the  memory  space   of  another  -  IMHO  to  write
fault-tolerant  code  you  need  *independent* processes  (not  shared
memory threads) - doing this takes  processor power - so I'd expect an
Erlang process to have 2-3 times  the overhead of a thread (because it
does a lot  more) - what is surprising is that  (say) Java threads are
so heavyweight.

  Light-weight threads are presumably great  if you want to convince a
Java programmer to use Python - so they can carry on using a difficult
to program shared  memory thread model - but  hardly something that is
desirable  in its own  right -  unless, of  course, you  actually like
solving problems in the most difficult way possible :-)


On Fri, 18 Apr 2003, HP Wei wrote:

> >> Stackless Python is more capable of tasklets
> >> switching than any
> >> other light-weight threading software package.
> >1. The benchmark itself seems kinda meaningless for a
> >claim of being a fast thread package. Where is the IPC
> >cost? The scheduling cost? The process creation cost?
> >etc, etc. (Not to mention realistic conditions ... :-)
> >My system was this: RedHat 8.x Athlon 1300+ with 512
> >MB of slow memory running out-of-the-box Erlang R9B1.
> >(system cost $400) 
> >Result: csw did AT BEST 6.4 million Erlang context
> >switches per second, and ON AVERAGE 5.8-5.9 million
> >Erlang context switches per second, over a range of
> >parameters (100k-10m context switches per benchmark
> >run).
>    I run Thomas's csw.erl on my machine: 
>    Sun-Blade-100 1GHz, 512Mb RAM, and SunOS 5.9, Erlang 5.2(R9B1)
>    The result is about 3.1 million CS per second.
>    (A factor two slower than Thomas's result.  Perhaps, I have a lot of
>     other stuff running on my machine.)
>    ----------------------------
>    I myself use python at work instead of perl (the company's standard
>    scripting language) because of its cleaner syntax.
>    I am learning Erlang now because of its simple (reads clear and effective)
>    communication stuff.
>  --HP

More information about the erlang-questions mailing list