About Haskell Thread Model

William Lee Irwin III wli at holomorphy.com
Mon Oct 13 03:31:50 EDT 2003


William Lee Irwin III wrote:
>> That's a painful-sounding state of affairs, though not entirely
>> unexpected. It would be interesting to hear of "BKL breakup" efforts
>> for Haskell runtime systems, though anymore I'm totally ignorant of
>> what the devil is going on in userspace except database-only syscalls.

On Mon, Oct 13, 2003 at 11:13:56AM +0200, Wolfgang Thaller wrote:
> I'm not sure I understand you. I found out that "BKL" refers to the 
> "Big Kernel Lock" (in the Linux kernel), but I have no idea what 
> "database-only syscalls" are.

remap_file_pages() (lightweight mmap() for doing, say, 65536 mappings
of distinct 32KB chunks of a file without kernel memory usage exploding)
and async io syscalls are examples of database-only syscalls, that I'm
aware userspace is doing largely from various kernel mailing list
controversies.


On Mon, Oct 13, 2003 at 11:13:56AM +0200, Wolfgang Thaller wrote:
> The reason why we currently do not take advantage of SMP is that the 
> Haskell Heap is a shared data structure which is modified whenever a 
> thunk (an unevaluated expression) is evaluated. Using synchronisation 
> primitives like pthread_mutex_lock for every evaluation of a thunk 
> would be deadly for performance.
> There is some old (1999) code in the GHC RTS that attempts this (using 
> intel cmpxchg instructions for synchronisation), but it's currently 
> "bitrotted" and I don't know how successful it was.

cmpxchg and then taking a blocking lock sounds like the 2-tier locking
supported with Linux' new futex system calls. I wonder how they chose
to block in the older GHC RTS.


-- wli


More information about the Haskell mailing list