Date: Fri, 21 Dec 2001 04:33:48 +0100 From: "Anthony Atkielski" <anthony@freebie.atkielski.com> To: "John Baldwin" <jhb@FreeBSD.org> Cc: "Jeremiah Gowdy" <jeremiah@sherline.com>, <advocacy@FreeBSD.org>, "Gilbert Gong" <ggong@cal.alumni.berkeley.edu> Subject: Re: Microsoft Advocacy? Message-ID: <033001c189d0$4e0703d0$0a00000a@atkielski.com> References: <XFMail.011220151201.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the references; I've added the books to my wish list, and I'll look at the code. One thing I wonder: If performance is so important that a few hundred clock cycles matter, why is the code written in C? ----- Original Message ----- From: "John Baldwin" <jhb@FreeBSD.org> To: "Anthony Atkielski" <anthony@freebie.atkielski.com> Cc: "Jeremiah Gowdy" <jeremiah@sherline.com>; <advocacy@FreeBSD.org>; "Gilbert Gong" <ggong@cal.alumni.berkeley.edu> Sent: Friday, December 21, 2001 00:12 Subject: Re: Microsoft Advocacy? > > On 20-Dec-01 Anthony Atkielski wrote: > > John writes: > > > >> Atomic operations are _quite_ expensive. On > >> x86, they lock the bus which means waiting until > >> the bus is free. > > > > How much time do you gain, percentage-wise, in the routines in which locks > > have been eliminated? > > On x86, atomic operations can take 100's of clock cycles in comparison with > zero when you dont' have to do the move at all. Not that lack of > load/modify/store is always faster than doing the operation. :) Also, note > that it is on if you have any sort of lock debugging turned on. > > >> If you really care, first go look at some > >> actual code to see where these things are > >> used and how ... > > > > Any suggestions on modules to examine? > > Any of the scheduler code in current. sys/kern/kern_synch.c (as well as > sys/kern/kern_intr.c:ithread_schedule() to see what we do for a hardware > interrupt). To see how mutexes are implemented, sys/sys/mutex.h, and > sys/kern/kern_mutex.c. The atomic manpage (man 9 atomic) on current will also > be helpful in grokking this stuff. Also, for a good reference about how > locking works in Unix, you can read the books 'Unix for Modern Architectures: > Symmetric Multiprocessing and Caching for Kernel Programmers' by Curt Schemmel > (I may have botched the name) or 'Unix Internals: The New Frontiers' by Uresh > Vahalia. For a brief overview of the types of locks used in -current, you can > also read my paper about the subject in the BSDCon proceedings. > > -- > > John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ > "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-advocacy" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?033001c189d0$4e0703d0$0a00000a>