File locking & device drivers

C.Reinke <>
Wed May 15 20:00:27 CEST 2002


> There is a mechanism in the Erlang emulator (virtual machine) that
> compensates for this problem. A process that sends a message to another
> process with a large message queue gets punished with getting sheduled
> out sooner. This mechanism diminsishes this producer/consumer problem.

That's a very useful bit of information. I don't think I've
come across it in my reading of Erlang book/documentation, though.

My first reaction was: great, that's the sensible thing to do.

Then I wondered: wait a second, doesn't Erlang use *selective
reading* of message queues? It wouldn't be great programming
style, and I think it's explicitly recommended in the design
guidelines to keep message queues clear, but what if that 
receiver with the large message queue is not busy processing 
the pending messages, but is waiting for that specific message 
to come in before dealing with the rest of the queue? Or, what
if I have a server with several clients, one of which happens
to be lacking behind in processing its input queue - should 
that really mean that the server gets scheduled out whenever
it has sent to that problematic client?

In brief: I think this scheduling behaviour should be 
documented very early on in the Erlang learning materials,
together with rationale and consequences.

Meanwhile, where could I find a description of the current
scheduling behaviour (apart from the source;-)? I've seen
it described as "fair", but there are different interpretations
of fairness in this context, and some aspects will be 
Erlang-specific.

Cheers,
Claus




More information about the erlang-questions mailing list