secret of light-weight user thread

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Sep 7 09:13:09 CEST 2011


Simon,

Thank you for explanation.

>  - We have an accurate GC, which means that the Haskell stack can be
>    movable, whereas the C stack isn't.  So we can start with small
>    stacks and enlarge them as necessary.

What is the difference between the Haskell stack and the C stack?
I guess that the C stack means CPU's stack. Is the Haskell stack a
virtual stack for a virtual machine (STG machine or something)?

I quickly read several papers but I have no idea.

>  - We only preempt threads at safe points.  This means that the
>    context we have to save at a context switch is platform-independent
>    and typically much smaller than the entire CPU context.  Safe
>    points are currently on allocation, which is frequent enough in GHC
>    for this to be indistinguishable (most of the time) from true
>    preemption.

I seems to me that StgRun saves CPU registers. You mean that StgRun
depends on CPU a bit but the rest part of context is CPU independent?

--Kazu



More information about the Glasgow-haskell-users mailing list