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

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

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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