Subject: Re: Test and set (was Re: postgreSQL)
To: Chris G. Demetriou <firstname.lastname@example.org>
From: John F. Woods <email@example.com>
Date: 05/26/1999 08:05:55
> > NetBSD doesn't have anything like this - would it be a waste of a system
> > call (or a possibly system-call backed library routine) to add some sort
> > of MI atomic test and set operation?
> Yes, it would be a waste of a syscall.
> This is best implemented without kernel interaction if possible,
> because of the cost of of a syscall. that's possible on several
> On architectures where it has to be implemented as a sycall, the right
> syscall already exists (sysarch()).
DG/UX used a different trap for threading system calls; the trap entry code
didn't save registers or check signals or most of the other heavyweight things
a system call needs to do. All it did do was (1) entitle the process to read
and write kernel space (of course, and which might be expensive all by itself
on some architectures) and (2) determine if the process could do what it
wanted without blocking. If the resource was available (or whatever), the
operation was performed and the process continued, otherwise the normal system
call handling code was called to allow the process to block.
"system call" doesn't have to equal "godawful slow". (Although it's obviously
not going to be as fast as a normal call in any case.)