Consider a case where we have multiple processor/cores and two threads. Is it possible to force the linux scheduler to always schedule the specific thread(both) to a specific processor at every instance of its execution. Is setting processor affinity to the threads, while creation, sufficient for this purpose
相关问题
- Is shmid returned by shmget() unique across proces
- How to let a thread communicate with another activ
- How can type 'SwigPyObject be registered using
- how to get running process information in java?
- Why it isn't advised to call the release() met
If you look at the man page for
taskset
you can see the following statement:This means that setting the CPU affinity for a particular process will make sure that it's always run on that CPU.
There exist API's that allow you to set thread affinity for particular threads, and I would imagine that this too will be honored by the OS scheduler.
If you look at
sched_setaffinity
you'll see a line that says:which means this will make sure your threads are only run on CPU's set by this function.