Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 would like to do this so I can accurately speed test my processes, and just to be able to have the illusion of control.

Maybe I want to reserve one processor for special programs. Maybe I want to write my own process optimizer. Who knows. The possibilities are endless in my mind.

Is this possible in any OS? If not why not? If we are allowed to compartmentalize memory, why can't we have such control over processors?


share|improve this question
possible duplicate of Setting CPU cores off-limits to all threads not specified (preferably in Windows 7) (although I've still never received a good answer for it...) – Shinrai May 1 '12 at 21:00
@Shinrai: what did you end up doing? Would autoitv3 have worked for you? – user420667 May 1 '12 at 21:22
We ended up having to approach it from another direction, honestly, because the Windows requirement for that customer was non-negotiable and we never could figure it out. I can't see how autoitv3 could do it. The problem is that it's trivial to get things to start on the processor you want - the hard part is keeping other things off of them. Modern OSes are very good at figuring out where to put things and they really don't like to let you fool with this - I'm guessing it can be done in Linux variants, but to what extent I don't know. – Shinrai May 1 '12 at 21:33
@Shinrai I had a look at your previous question, and indeed you can do it with AutoIt (the scripts can also be compiled directly into .EXE files to avoid distributing the AutoIt runtime). Basically, find a program which can list the process' affinity, and modify all of them accordingly. – Breakthrough May 1 '12 at 21:35
@Breakthrough - But what about new processes that start after that? (I'd add that I don't have any practical concern for this anymore but it is still an interesting intellectual exercise (and that's why I've upvoted this as well)) – Shinrai May 1 '12 at 21:46

On Linux, cpusets should work for this.

share|improve this answer
+1, I have not used linux much. Would it be possible to use cpusets to set the active executables to exist in only one specific processor? – user420667 May 1 '12 at 21:26

This is in theory possible. The easiest way to accomplish something close to this would be with a virtualization platform that lets you assign specific CPU/cores to a specific VM. Then you could run just the process you want on a given VM (of course with the bare minimum of OS overhead).

share|improve this answer
+1 That might work but it's not really what I was looking for. I guess I'm just a control freak. – user420667 May 1 '12 at 21:21

The easiest way to do this is by setting the processor affinity for a given process, or telling the OS which logical CPUs (cores) that process is allowed to run on. If you right-click on a process in the Windows Task manager and select Set Affinity..., you'll find a window that looks something like this:

Setting the processor affinity in windows

In linux-based systems, you can do the same thing with the taskset utility or by setting the appropriate CPU mask flag in the processes' /proc entry.

Sadly, there's no easy way to remove all processes from a certain processor, or to automatically set a specific mask on a process when it starts up-- you'll need a script to monitor for new processes on the system and set the appropriate affinity that you desire.

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.