Subject: Re: Atomic ops API
To: Ben Harris <bjh21@netbsd.org>
From: None <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 03/13/2007 08:49:12
In message <E1HR9zL-0003p7-00@chiark.greenend.org.uk>,
Ben Harris writes:

>In article <F16DC85F-0EF6-4EB1-A868-7212DC4D80B2@shagadelic.org> you write:
>>I would like to propose the following as NetBSD's API for atomic  
>>operations, both in user-space and the kernel.
>
>Am I right in thinking that on dull uniprocessor systems (say, most
>ARMs), the userland versions would be implemented by a bunch of RASes?

It might be better to pick one flexible RAS per machine (like CAS),
and implement other atomic "primitives" using that.  (Jason seems to
be suggesting something like that).  The cost of iterating over large
numbers of different RAS sequences, checking the userland PC against
each range, might not scale well.  If memory serves, Bershad et. al
implemeted *one* RAS sequence on a MIPS r3000, and used that to
synthesize other atomic operations.

OTOH, "premature optimization is the root of all evil".
Some numbers would be great.