threads - use them as much as you can

Sean Hinde Sean.Hinde@REDACTED
Thu Nov 30 18:35:52 CET 2000


Alex,

> 1) Multiprocessing (SMP)

You are correct that Erlang processes exist entirely within the virtual
machine. It is certainly possible to run more than one instance of Erlang
(with different node names) on a single machine and use Erlang message
passing to communicate between them.

Shared memory and native Erlang threads are in the realms of research at the
moment.


> 2) Scalable I/O
> 
> Do the underlying I/O mechanisms of the VM use scalable I/O primitives
> such as select() or poll()? (or aio_*() -- asynchronous I/O).   

As I understand the VM uses select but in a way that returns immediately.
The virtual machine scheduler check regularly for input.

Language level i/o operations are implemented such that only a limited chunk
of the i/o is carried out at one time by the libraries/VM, which normally
guarantees that it doesn't block for very long. (however looking at a file
over a slow NFS mount for example can hang the emulator).

> Also, this question is somewhat tied to the first, since if only one
> native threads is used and regular blocking I/O is used, then all
> processes would be "suspended" until that particular I/O completes.

In R7B (the current release) there is a new feature which introduces a pool
of native threads for i/o operations but this is disabled by default. This
will get around the hanging problem but at the moment is supposed to be
quite slow for database work due to the large amount of context switching
involved (I've not tested it myself yet so don't know the scale). I guess
this will improve in forthcoming releases.

http://www.erlang.org/doc/current/doc/highlights.html

Having said all that from your brief description your application seems to
be well and truly the kind of application Erlang is designed for. Welcome!

-Sean



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list