From owner-freebsd-advocacy Thu Dec 20 19:33:55 2001 Delivered-To: freebsd-advocacy@freebsd.org Received: from freebie.atkielski.com (ASt-Lambert-101-2-1-14.abo.wanadoo.fr [193.251.59.14]) by hub.freebsd.org (Postfix) with ESMTP id C39EB37B416; Thu, 20 Dec 2001 19:33:50 -0800 (PST) Received: from contactdish ([10.0.0.10]) by freebie.atkielski.com (8.11.3/8.11.3) with SMTP id fBL3XmR31400; Fri, 21 Dec 2001 04:33:49 +0100 (CET) (envelope-from anthony@freebie.atkielski.com) Message-ID: <033001c189d0$4e0703d0$0a00000a@atkielski.com> From: "Anthony Atkielski" To: "John Baldwin" Cc: "Jeremiah Gowdy" , , "Gilbert Gong" References: Subject: Re: Microsoft Advocacy? Date: Fri, 21 Dec 2001 04:33:48 +0100 Organization: Anthony's Home Page (development site) MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-advocacy@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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" To: "Anthony Atkielski" Cc: "Jeremiah Gowdy" ; ; "Gilbert Gong" 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 <>< 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