• 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: Importance of thread safety and performance.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importance of thread safety and performance.


  • Subject: Re: Importance of thread safety and performance.
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 9 Jul 2005 13:54:02 -0700

On Jul 9, 2005, at 10:55 AM, アンドレ(Andre) wrote:
Well, maybe "a lot". I just want to be "safe" in design from the start.
I think doing a posix lock and unlock is not very performance hurting,
but maybe NSLock is - because of Obj-C messaging... double the messages
just for thread-safety doesn't sound good...

Excessive pthread locking can also impact performance, because locking involves more than just setting a bit somewhere. There's a significant amount of synchronization involved, particularly on multiprocessor machines.


Pandaa's suggestion to keep your multithreading at the level of "coordinating" objects and lock at a slightly larger granularity is a good one. Locking in some accessors may be unavoidable, but you probably don't want to do it in every accessor...

  -- Chris


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Importance of thread safety and performance.
      • From: Andre <email@hidden>
References: 
 >Importance of thread safety and performance. (From: アンドレ(Andre) <email@hidden>)
 >Re: Importance of thread safety and performance. (From: Jonathon Mah <email@hidden>)
 >Re: Importance of thread safety and performance. (From: アンドレ(Andre) <email@hidden>)

  • Prev by Date: Drawing lines between text
  • Next by Date: Re: failed objc_getClass...
  • Previous by thread: Re: Importance of thread safety and performance.
  • Next by thread: Re: Importance of thread safety and performance.
  • Index(es):
    • Date
    • Thread