Re: How to limit number of CPU cores used by a Cocoa app
Re: How to limit number of CPU cores used by a Cocoa app
- Subject: Re: How to limit number of CPU cores used by a Cocoa app
- From: Chris Hanson <email@hidden>
- Date: Sat, 29 Dec 2007 18:51:56 -0800
On Dec 29, 2007, at 9:09 AM, Andre Schnoor wrote:
is there any possibility to limit the number of CPU cores used by
the threads of a Cocoa application? I could not seem to find any
documentation on this via Google yet.
I need to allocate up to a maximum of 2 cores only, even though the
app schedules many more threads at times (up to a dozen). Can this
be achieved by configuring the application's properties, or will it
require more sophisticated hacks?
This is not the way Mach is designed to work.
Mach's unit of scheduling is the thread, and it will schedule threads
across all available cores on all available CPUs taking code and data
affinity into account.
Why do you think restricting threads to run on only 2 cores will be
useful? My first guess is that you may be running into
synchronization problems with data that's shared between two threads.
That's a bug in your code and needs to be addressed by ensuring the
synchronization is correct; just reducing the number of cores
available for scheduling will probably still exhibit the problems at
some time.
In the future, when asking a question like this, it'll be useful to
describe what your goal is rather than just one way you think you
might be able to achieve it. That will lead to better help from the
list.
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden