[Haskell-cafe] Real-time garbage collection for Haskell

Jeremy Shaw jeremy at n-heptane.com
Mon Mar 1 18:18:27 EST 2010

I am just going to jump on the RT dogpile and mention that I too have wanted
RT friendly GC in Haskell. I have attempted on more than one occasion to
implement real-time audio applications in Haskell. But I tend to get a lot
of buffer underruns, most likely due to GC.

For audio apps, there is a callback that happens every few milliseconds. As
often as 4ms. The callback needs to finish as quickly as possible to avoid a
buffer underruns. So, in theory, I believe I would want garbage collection
to only happen in the time periods between when the callback is running.
This wouldn't affect the total amount of time that garbage collection ran --
but it would help minimize the amount of time spent in the callback, which
should reduce buffer underruns.

My feeling right now is that the 'best' solution might be something similar
to synthesis OS. I would create a DSL for the realtime DSP code. Using
harpy, this DSL would be compiled to assembly with execution time guarantees
(as much as can be predicted on modern hardware). For a 'modular synth' this
might actually be better than C code, because the effects of certain choices
could be 'compiled in' instead of having to check the setting via a compare.
(that is what Synthesis OS does).

- jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100301/41ad9e26/attachment.html

More information about the Haskell-Cafe mailing list