4

I have a math-intensive Android application here that does realtime audio generation. It generates sound data and this process is difficult if not impossible to modify to support multithreading.

The test systems are ARM-based quad core CPUs (Nexus 4, Nexus 7) and one dual core x86 Atom with hyperthreading (Asus Memo Pad FHD 10).

The problem that I'm facing is that the android scheduler keeps moving my thread around on multiple cores, I lose all my caches everytime and the performance could be much better. I get a huge performance boost when I set the affinity of the thread to a single core.

Would you recommend to do it that way on mobile devices or is this a "no go"?

Lyve
  • 218
  • 1
  • 11
  • IIRC, setting thread affinity is a privileged operation. Were you expecting this to work on non-rooted devices? – fadden Nov 14 '13 at 16:02
  • yes, it works without problems from the C side (using NDK) by calling syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask); – Lyve Nov 14 '13 at 16:09
  • You may mean setting thread affinity for other processes, I doubt that this is a privileged instruction if done for my own process. – Lyve Nov 15 '13 at 09:16

0 Answers0