Using Process.ProcessorAffinity on a system with 32+ logical cores

I am trying to adjust the proximity of a processor to a process on a machine with 16 physical core cores, 32 logical ones. We used to use int, but this is an overflow when you have 32 logical cores.

Will a long one be used instead of an int when the processor compatibility setting is still working?

See code below.

 try
 {
    string pathToExe = GetPathToExe( jobType );

    long processorAffinity = DetermineProcessorAffinity();

    Process jobProcess = Process.Start( pathToExe, jobId.ToString() );
    if ( jobProcess != null )
    {
       jobProcess.ProcessorAffinity = new IntPtr( processorAffinity );
    }

 }
+3
source share
2 answers

From IntPtr Documentation :

The IntPtr type is for an integer whose size is platform. That is, an instance of this type is expected to be 32-bit on 32-bit hardware and operating systems and 64-bit 64-bit hardware and operating systems.

: 64- , 32- . , .

+2

ProcessorAffinity Win32 SetProcessAffinityMask.

32 , .

, 32- . 32- IntPtr - 32 . IntPtr long int, .

+3

All Articles