NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [Haskell-cafe] Rewrite NetBSD kernel driver using Ajhc Haskell compiler



On 2014-02-19 16:30, Kiwamu Okabe wrote:
Hi Johnny, I had forgotten important point.

On Wed, Feb 19, 2014 at 11:57 PM, Johnny Billquist <bqt%update.uu.se@localhost> 
wrote:
Maybe someone with more insight could explain to an idiot like me how
Haskell garbage collection is handled when running in the kernel?

Running a simple logic in the kernel, it doesn't call GC.

http://www.slideshare.net/master_q/20140117-11th-wocs2/19

Ajhc Haskell compiler creates program binary that has "context local heap".
A lot of binaries have only one global heap.
If C language code calls Haskell code, Ajhc runtime create new arena for GC.
Sometime Haskell code runs allocator (s_alloc()),
then the runtime allocates Heap area.
Haskell context gets the end of life, the arena and heap are recovered
by the runtime.

In the kernel, the recover is called before the GC.
But I think my custom kernel is ready to call GC in interrupt handler.

Thanks. Not sure I followed this, though.

Are you saying that you essentially avoid GC by creating a large fresh heap every time you call something written in Haskell, and then delete the heap when the Haskell function returns? And that the current piece of code running in Haskell is short enough that GC never is done?

        Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index