Use only one processor on multy-processor machine

  • Thread starter Thread starter Vitaly Sedov
  • Start date Start date
V

Vitaly Sedov

Hello!

How can I use only one processor to run my application on multy-processor
machine?

Thank you,
Vitaly Sedov
 
I thought windows handled the assignment of processor time? Maybe if the
process only operates in one thread it would only use one processor.
 
Hi,

I suppose you can set the ProcessorAffinity property of the process
which owns that thread. But note that this would apply to all the threads in
that process.
Process.GetCurrentProcess.ProcessorAffinity = <Value, a bitmask>.

It is recommended that you correctly evaluate this option. This has direct
performance implications on your app.
 
Hello Vitaly,
How can I use only one processor to run my application on multy-processor
machine?

you can use the Win32 API call "SetProcessAffinityMask" (I think it's
call alike) to have your application handled by a specific processor.

Have a look into the MSDN library.

Regards,
Stevie
 
Back
Top