• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: multithreading, dual-core
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multithreading, dual-core


  • Subject: Re: multithreading, dual-core
  • From: George Warner <email@hidden>
  • Date: Tue, 27 Feb 2007 08:41:00 -0800
  • Thread-topic: multithreading, dual-core

on 2/26/07 1:48 PM, Chris Hanson at <email@hidden> wrote:
> On Feb 26, 2007, at 10:30 AM, George Warner wrote:
>> 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".
>
>> If at all possible use atomic operators (great for ref-count modifiers);
>> then spin-locks and only as a last resort conditional mutexes.
>
> I'd say exactly the opposite:  One newbie mistake that I often see is not
> locking sufficiently, and trying to optimize away synchronization before
> ensuring correctness.

I guess the consensus here is that an experienced MT/SMP programmer neither
under or over locks.  ;-)

Under locking would fail to properly protect your data and over locking
would protect your data but at an increased risk of deadlocks and at a
greater performance penalty.

If I might expand on my earlier opinion: It's a newbie mistake to over lock
(because the only thing I remember from the class in college was that you
have to use a lock to protect your data when it might be accessed via
multiple threads...) and an intermediate mistake to under lock (because I
read this internet article about how to avoid deadlocks by avoiding
locks...).

YMMV. ;-)

--
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:

This email sent to email@hidden

References: 
 >Re: multithreading, dual-core (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: libsystem compatability from os 10.2 to 10.4
  • Next by Date: Re: Script to build all configurations?
  • Previous by thread: Re: multithreading, dual-core
  • Next by thread: Libstdc++ problems
  • Index(es):
    • Date
    • Thread