Brian wrote:
After a bit of research , the issue of setting the cpu affinity has been
solved , which may be of use to other folks.
A bit of info here concerning the data type cpu_set_t , which as far as I
can determine (no help from the mess that is the c library source) is
essentially an array of DWORD. For my purposes running on an x86 CPU ,
allowance for 32 cores is sufficient , using cpu_set_1 as one unsigned long
word.
http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
Here are some code fragments which may be of help.
The function do_SysCall(0) basically doesn't work for setting the CPU core.
Although the Linux documentation claims sched_setaffinity() amd
sched_getaffinity() work for threads , it only works for processes.
pthread_getaffinity_np() and pthread_setaffinity_np() work properly for
threads.
Thanks for that, interesting. I'd have expected affinity to have been
oriented towards processes rather than threads, since I think it largely
originated when people started working on NUMA systems- possibly at SGI.
There's also interrupt affinity, which becomes significant when (the bus
associated with) an I/O device is "nearer" some CPUs than others. I've
had hardware of this type in the past, but in those days kernel support
for these calls was patchy.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal