Linux – Set process exclusivity in Linux

linuxprocessprocess-management

I am trying to measure the performance of a process. I have widely ranging performance measurements on small bit of single-threaded deterministic code that should perform the same every time.

I would like to set exclusive use of a processor for the process in order to test if the performance fluctuation is due to scheduling of other processes, context switches, etc. I don't care about affinity because I don't care which core it runs on. What I do care about is that my single-threaded process has exclusive access to the core it runs on, whichever core that is. Is this possible? I don't think 'nice' does what I want because that just lets me set a priority. Some other task with the same priority may share processor time with my process. I also don't care if my process has to wait in a queue. I just want to ensure that once it starts running, it is not interrupted.

Thanks

Best Answer

Could always use taskset -c 0 in order to set the process you want to have uninterupted to the first core then set all other processes to use other cores. Sounds pretty inefficient IMHO but it would accomplish what you are looking to do.

Related Question