Re: Importance of thread safety and performance.
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