threads - use them as much as you can

Ulf Wiger etxuwig@REDACTED
Mon Nov 27 22:22:20 CET 2000

On Mon, 27 Nov 2000, Sean Hinde wrote:

>They have also included some things Erlang doesn't have which the "Hard Real
>Time" crew use including:
>*  Many thread priorities with timely pre-emption when higher priority
>threads become runnable (e.g. by receiving an async message).

Yes, I was intrigued by the idea of immediate preemption for
high-priority threads. This might be handy.

As for many thread priority levels, I remain unconvinced. In AXD 301,
we've settled on job scheduling/prioritization. Basically, programmers
get to decide what consitutes a job, or a work unit. We have a simple
but efficient job scheduler which implements a weighted round robin on
a configurable number of job queues.

Perhaps the reason why this works so well for us is that a switch is
very much job based - as is e.g. a web server. It really doesn't
matter how many threads are involved in the completion of a task: when
a job has been accepted by the system, it needs to be finished in a
timely manner; a job that cannot be accepted should be rejected as
soon as possible.

Using this scheme, we've achieved absolutely remarkable load tolerance
figures: our system can operate at 95% throughput even at 150% load,
and yields 40% throughput at 1000% load!!

Regarding process priorities, we keep it very simple. Just about all
processes operate at normal priority. Processes that act as message
dispatchers are set to high priority, since they do not create any
work themselves, but rather act as drivers.

We don't use low priority at all, partly because we've found that if
you have hundreds of normal priority processes and only a few low
priority processes, the low priority processes will actually get
higher priority than the normal priority processes.

Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB

More information about the erlang-questions mailing list