3

I have a program that runs on my server, I want to run multiple instances of the same program (its an application that can only run on a single core..), im wondering if I can assign them to a core at runtime? using a batch script or something? Im running windows server 2012.

4
  • Do you not trust the kernel's scheduler to sort this out on its own?
    – EEAA
    Feb 1, 2014 at 18:08
  • Oh wait it does it automatically and im just being a moron right?
    – James T
    Feb 1, 2014 at 18:18
  • If you have six cores, just start six copies of the program. Feb 1, 2014 at 19:20
  • @James Trotter: stackoverflow.com/questions/7759948/…
    – Greg Askew
    Feb 2, 2014 at 1:04

2 Answers 2

6

Wait a second... you asked a question, and you accepted an answer of "don't do that."

No one actually answered your question.

Please don't take me the wrong way. No offense at all to any of the other answerers, and I do agree with them that you're probably not thinking this all the way through if you have to ask this question in the first place... but, you asked a specific question nevertheless.

So here's the answer.

C:\Windows\system32>start /affinity 1 notepad.exe

That will start an instance of the Notepad.exe process set to an affinity to the first CPU only. You can mix and match CPUs (cores) if you wish, but you asked how to start a process on a single CPU.

You can verify that the command worked by checking the resulting processes' affinity in Task Manager or Process Explorer.

2
  • "the path system32>start is invalid" in windows 10 Aug 24, 2021 at 13:22
  • @Aleksandrus That is just the command start while being in the directory C:\Windows\system32 , which is the default directory for administrative command prompts. It doesn't really matter from which directory you start it though (at least in this example). Dec 16, 2022 at 6:22
2

In the vast majority of circumstances, trying to manually manage process-to-CPU bindings will actually result in overall reduced performance than by just letting the kernel's CPU scheduler sort things out.

So, unless you run into some actual performance issues that can be directly traced back to CPU scheduling, this isn't something you need to think about.

1
  • Agreed - I've never had to manually assign cores outside of troubleshooting
    – Dan
    Feb 1, 2014 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .