processor affinity and GThread
- From: Rick Jones <rick jones2 hp com>
- To: gtk-list gnome org
- Subject: processor affinity and GThread
- Date: Wed, 08 Mar 2006 10:53:17 -0800
Netperf4 is a multi-threaded network performance benchmark. There is a
main thread in the netperf4 netserver that creates "test threads" which
run test-specific code that we really don't want to need/have any
platform-specific knowledge.
One of those things is CPU binding - binding the test thread to a
specific CPU, CPU set or locality domain. To "protect" the test thread
and its code from that platform-specific knowledge the main netserver
thread makes processor affinity calls to set the processor affinity of
the newly created test thread.
This is fine with pthreads under HP-UX and Linux - the main netserver
thread can go ahead and make the affinity call(s) and affect the
affinity of the test thread. The affinity calls take platform native
thread id's and so the pthread_t is just passed-in. The test thread
remains fat dumb and happy doing its test-specific thing.
Now, with the addition of the gthread abstraction to port netperf4 to
Windows, and ultimately I suppose use of gthreads on other platforms
(particularly when netperf4 goes gui with gtk+) I don't have the native
thread ID at my fingertips.
I know it is evil and a "don't do that!" sort of thing, but barring
plans to add affinity calls to gthread (and even then for the interim),
it seems I need to know how to peel-back the opaque veneer of the
GThread abstration to retrieve the native thread id contained therein.
Has anyone got examples of that?
sincerely,
rick jones
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]