Hello,
Perhaps this is not 100% on-topic, but just in case people in this forum have come across this before --
I am running the Power PMAC on the Dual Core 465 CPU. Besides the normal Delta Tau code, I am also running a Xenomai C++ task.
When I started to look at performance and CPU use, I noticed that my task was using up 20% CPU or so (using cat /proc/xenomai/stat). I also noticed it was on the same CPU as the PMAC tasks.
So I added this to my C++ code:
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(1, &set);
if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)
CPUAffinityFault = true;
This looks to work great, as when I do cat /prox/xenomai/stat, I now see that my threads are all running on CPU 1, not 0 as is the default apparently.
Unfortunately, after running my code for 2-3 minutes, it crashes with a fun segmentation fault... If I remove the affinity code, it runs fine and does not crash.
Does anyone have any thoughts on this? I am accessing PMAC shared memory (pshm->....). Perhaps you can't do that across different cores? Or if you do, is there some synchronization code I need to add?
Thanks!
Robbert