Date: Wed, 09 Jun 2004 20:26:29 +0200 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: "M. Warner Losh" <imp@bsdimp.com> Subject: Re: cvs commit: src/sys/kern kern_proc.c Message-ID: <57369.1086805589@critter.freebsd.dk> In-Reply-To: Your message of "Wed, 09 Jun 2004 20:20:41 %2B0200." <20040609182041.GV12007@darkness.comp.waw.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20040609182041.GV12007@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@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57369.1086805589>