Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2001 15:12:01 -0800 (PST)
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>
Subject:   Re: Microsoft Advocacy?
Message-ID:  <XFMail.011220151201.jhb@FreeBSD.org>
In-Reply-To: <02b601c189aa$632a5990$0a00000a@atkielski.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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?XFMail.011220151201.jhb>