Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
Read up on cgroups and exclusive cpusets. stackoverflow.com/questions/6816069/… – Mikel May 3 '12 at 18:57

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.

share|improve this answer
Thanks. The only 'efficient' thing I could think to do is isolate a core and reboot the box. That's an option but I was looking for something less intrusive. – user1332148 May 3 '12 at 19:21

The best you can do is use chrt to set the scheduling class of the process to realtime.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.