Possible Duplicate:
CPU Affinity
I'm running on Linux and I want to write a C++ program that will set 2 specific processors that my 2 applications that will run in parallel (i.e. setting each process to run on a different core/CPU). I want to use processor affinity tool with C++. Please can anyone help with C++ code.
From the command line you can use taskset(1), or from within your code you can use sched_setaffinity(2).
E.g.
You need to call sched_setaffinity or pthread_setaffinity_np
See also this question