[erlang-questions] Questions about processes and message queues

Dominic Williams erlang@REDACTED
Wed Feb 4 15:40:40 CET 2009

Hello Nicola,

> i have some doubt about processes and message queues.
> What does happend if a fast process keeps sending messages to a slow
> process? Does the queue keeps growing arbitrarly or is there some kind of
> limiting mechanism ? If so, how does it work exacly?

Have you tried to see what happens if a process sends itself
messages and never reads them? In the shell:

1> F = fun (G) -> self() ! hello, G(G) end.
2> Report = fun (Pid, R) -> io: fwrite ("~p~n", [erlang: process_info
(Pid, [memory, message_queue_len])]), timer: sleep (5000), R(Pid, R) end.
3> Report (spawn (fun () -> F(F) end), Report).

As you see, the message queue just keeps growing.

The language does not allow you to limit the length of the
queue. You must design your application in such a way as to
have end-to-end flow control.


Dominic Williams


More information about the erlang-questions mailing list