mt-smp
[Prev] Thread [Next] | [Prev] Date [Next]
Re: Thread Affinity - posix vs. cocoa threads Markus Stürmer Wed Jul 16 05:03:02 2008
Am 08.07.2008 um 21:35 schrieb George Warner:
On Tue, 8 Jul 2008 15:05:58 +0200, Markus Stürmer <[EMAIL PROTECTED]> wrote:Currently I'm investigating codes that try exploiting the shared caches of the Core2 architecture. As I want use my codes also on other systems, I'm usually programming in C++ using posix threads. Therefore I cannot use the thread affinity interface the recommended way of first creating an NSThread in Cocoa and setting its affinity tag before actually starting it. I can only start my threads first using pthread_create and can set their affinity afterwards, hoping that the OS finds it appropriate to schedule or migrate the threads the way I like them.So use the thread_policy_get/thread_policy_set API:<http://developer.apple.com/releasenotes/Performance/RN- AffinityAPI/>
I _do_. I don't even know another possibility on MacOS (and only with Leopard).
But with pthreads, I can only spawn a thread without affinity (I think this is the default) and set its affinity tag when it is already running. As it seems, setting the thread affinity will not make Leopard migrate threads with the same affinity tag to the same die (i.e. shared cache), at least not in reasonable time.
If one wants a thread to already have some affinity information when it starts executing, one has to use Cocoa (as far as I understand), and this is well described in the documentation you have cited. However, pthreads aren't even mentioned there — perhaps the affinity API just doesn't work well for threads already executing.
Regards, Markus
-- Enjoy, George Warner, Schizophrenic Optimization Scientist Apple Developer Technical Support (DTS)
_______________________________________________ Do not post admin requests to the list. They will be ignored. Mt-smp mailing list ([EMAIL PROTECTED]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mt-smp/alexiscircle%40gmail.com This email sent to [EMAIL PROTECTED]
- Thread Affinity - posix vs. cocoa threads Markus Stürmer
- re: Thread Affinity - posix vs. cocoa threads George Warner
- Re: Thread Affinity - posix vs. cocoa threads Markus Stürmer <=
- Re: Thread Affinity - posix vs. cocoa threads Wade Tregaskis
- Re: Thread Affinity - posix vs. cocoa threads Markus Stürmer
- Re: Thread Affinity - posix vs. cocoa threads Markus Stürmer
- Re: Thread Affinity - posix vs. cocoa threads George Warner
- Re: Thread Affinity - posix vs. cocoa threads Markus Stürmer
- Re: Thread Affinity - posix vs. cocoa threads George Warner