Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multithreading, dual-core



On Sun, 25 Feb 2007 11:37:21 -0800, Shawn Erickson <email@hidden>
wrote:
> Often it is the algorithm and not the locking overhead that is a problem.

One "newbie" mistake I often see is over locking. The fastest and least
likely lock to deadlock is the ones you can completely avoid. Google
"lockless programming".

Also read up on read/write (rw)locks. If you have a data structure that's
mostly read and only occasionally written this lock will allow multiple
readers simultaneous mutual access except when a write is requested; then
the writer is granted exclusive access.

If at all possible use atomic operators (great for ref-count modifiers);
then spin-locks and only as a last resort conditional mutexes.

P.S. Welcome to the Schizophrenia. ;-)
-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.