News for hackers. Stuff that matters.
Re:Erlang vs Java memory architecture by silentbicycle on Wednesday April 13, 2011 @10:53AM (#2442486)
IIRC, the Erlang scheduler increases the cost of sending a message to a process as its queue grows, so that processes which are piling messages on a backlogged processes give it a chance to catch up.
Re:Erlang vs Java memory architecture by damienkatz on Wednesday April 13, 2011 @02:15PM (#2443449)
I don't think this is true. I wrote a blocking queue implementation for the purpose of limiting the # of messages or amount of memory used by a queue.
Re:Erlang vs Java memory architecture by silentbicycle on Wednesday April 13, 2011 @03:18PM (#2443716)
I'll see if I can find a citation, pretty sure it was in a paper I read about optimizations in the Erlang VM's scheduler. May be a recent thing.

Edit: Here's one (http://www.haskell.org/pipermail/haskell-cafe/2006-January/0...):

"Regarding the issue of why a logger process in Erlang does not get overwhelved, this is the reply I got from Raimo Niskanen (Erlang team at Ericsson):

There is a small fix in the scheduler for the standard producer/consumer problem: A process that sends to a receiver having a large receive queue gets punished with a large reduction (number of function calls) count for the send operation, and will therefore get smaller scheduling slots."

Sending to a mailbox costs reductions proportional to how many messages are already queued. While this isn't a perfect solution, it should influence the scheduler quite a bit. (Imagine trying to do that sort of thing in node.js!)