How to launch a program on a specific CPU ?

J

JBL

Hi,
I'm using Win2K in a Dual Intel Xeon server (E7501
chipset), SMP architecture, hyper-threading turned on and
I would like to launch a program on a specific CPU.

Is there a way in Win2K to do that ?

I've seen in Windows Task Manager that in the processes
it was possible to set the priority and the affinity of
the process but nothing about selecting a CPU to run the
process.


Thanks for your help
Best Regards
JB
 
W

William DePalo [MVP VC++ ]

JBL said:
I'm using Win2K in a Dual Intel Xeon server (E7501
chipset), SMP architecture, hyper-threading turned on and
I would like to launch a program on a specific CPU.

Is there a way in Win2K to do that ?

I'm not sure about this as I have not tried it but I would _guess_ that you
could use CreateProcess() with the CREATE_SUSPENDED option. Armed with the
handle to the process you could call SetProcessAffinityMask(), and then
ResumeThread() against the handle to the thread returned by CreateProcess().
That done you would close both handles and let the process run normally.

Just by the way, the docs say that processor affinity is inherited so it
ought to be possible to create a launcher which has an affinity with a
particular processor and use it to launch other processes on the same
processor.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top