Subject: Re: ingres and atomicity
To: None <tech-userlevel@netbsd.org>
From: James K. Lowden <jklowden@schemamania.org>
List: tech-userlevel
Date: 06/14/2005 22:36:00
der Mouse wrote:
> >> It is a highly platform (well, CPU, mostly)-specific question.
> > I know, but I'm a userland program, so I need a kernel service.
>=20
> No...you may need an architecture-dependent service, but that doesn't
> necessarily mean a kernel service.  A routine form an OS library such
> as libc might do as well.

I see.  I've been assuming that atomic memory operations are privileged
instructions available only to the kernel.  You and Jason are telling me
that assumption doesn't hold across CPU architectures. =20

> If you have data large than one bit with that property - such as the
> 32-bit values you quote David Laight as writing of - then the problem
> gets correspondingly easier.
>=20
> However, that's a theoretical result.  Depending on various factors
> such as how large the critical sections in question are, it may or may
> not be more efficient to do such things than to punt to a syscall.
>=20
> If you want I can go dig out the references I used and reconstruct my
> conclusions.

I don't want to put you to that trouble, Mouse.  I'm a long way from
exploring theoretical limits.  The Ingres compatibility layer is a messy
chunk of preprocessor line noise, but it seems to do its job of isolating
machine-specific features.  Now that I understand the context a little
better, I'll go off and write something extremely na=EFve and probably
broken.  By the time I get to the point that it links and crashes
horribly, I should have better information about what these routines are
supposed to do, and -- thanks to you folks -- a better understanding of
how to implement them on NetBSD. =20

Regards,=20

--jkl