cvs commit: src/sys/kern kern_proc.c
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Jun 9 18:26:49 GMT 2004
In message <20040609182041.GV12007 at darkness.comp.waw.pl>, Pawel Jakub Dawidek w
rites:
>BTW. Do we assume that atomic operations are atomic on MP machines?
>I read atomic(9), but I still don't know if I should use it or not for
>things like those.
Ok, let us dispell the first misconception about atomic operations:
Atomic operations are not cheap!
In fact, there are architectures where they are significantly more
expensive than mutexes.
Next: Atomic operations are much harder to grasp mentally, and
close to impossible to validate automatically.
We have no WITNESS which will tell us about problems with atomic
operations.
Therefore: Do not use atomic operations, use a mutex.
If we find a place where atomics will result in a significant
performance increase, we will apply them there after careful
consideration and considerable benchmarking.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the cvs-src
mailing list