[Haskell-cafe] Help with "shootout"
matth at mindspring.com
matth at mindspring.com
Mon Jan 2 23:03:32 EST 2006
On Tue, Jan 03, 2006 at 12:07:43AM +0000, Joel Reymont wrote:
>
> On Jan 2, 2006, at 9:20 PM, Chris Kuklewicz wrote:
>
> > This makes me ponder one of the things that Joel was trying to do:
> >efficiently pass data to a logging thread. It may be that a custom
> >channel would be helpful for that as well.
>
> I have not taken the time to analyze the Chameneos code but need to
> point out that my problem was not with efficiently passing data to
> the logging thread. The issue was with data accumulating in the
> channel and the logger thread not reading it out fast enough.
>
> The TChan implementation is a single-linked list implemented on top
> of TVar's. That would seem pretty efficient to me.
It's simple and efficient but does nothing to prevent the channel from
growing out of control. A slightly modified (custom) channel based on
TChan, but enforcing a maximum size (blocking on insert if the channel
is too full), probably would have solved the problem.
I assume that Erlang either does that or increases the priority of
threads with large event queues, or both.
Thanks,
Matt Harden
More information about the Haskell-Cafe
mailing list