Subject: Re: lock-free data structures
To: None <tech-kern@netbsd.org>
From: None <joerg@britannica.bec.de>
List: tech-kern
Date: 01/04/2006 08:39:36
On Tue, Jan 03, 2006 at 09:22:43PM -0500, kpneal@pobox.com wrote:
> 
> Here's one example of an issue: Atomic operations spin. With many threads
> contending this results in lots of CPU being burned with little actual
> work going on. Contrast this with lock types that forfeit the CPU when
> they block.

Sorry, but your design is seriously flawed either way, if lots of CPU
contest for a single lock. Using a block mutex doesn't make it cheaper
at all, it just moves part of the contention from userland into the
kernel. If you replace the spinning (and consider Ethernet collision
style handling with random delays) with a contention-free token passing,
you have to modify your program a lot more to not hit critical latency
issues.

Joerg