Jump to content

Recommended Posts

Posted

Hi, i have a program that use 100% of all Threads of my CPU.

It become impossible to do anything else on this machine when processing.

I wan't to disabled the affinity of the first and the second for that process.

I can find a lot of example to use the first and the second, like: 

;_WinAPI_SetProcessAffinityMask($hProc, 0x01) ;Set affinity for 1-st core
;_WinAPI_SetProcessAffinityMask($hProc, 0x02) ;Set affinity for 2-nd core
_WinAPI_SetProcessAffinityMask($hProc, 0x03) ;Set affinity for both cores

... but how to do the inverse?

My machine is 56 threads! 

Thank you for your help.

 

 

Posted

What happens if you set the affinity to all but those?

i understand that you say it uses all, but i just mean, set affinity "on top" of it.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

How many cores do you have? And on which core(s) do you want to run your process? For example if you have 4 cores and you want to run just on cores 3 and 4 then your mask will be 0x0C.

Posted (edited)

Thank you for your interest.

I have 14 cores x 2 hyperthreaded, so 56 threads.

I wan't to disabled the first 4 threads of an running process.

 

It will be great if this script could work not depending of the maximum threads a machine have.

Because i would like to run on several machine that have different number of cores.

But everytime, i want the same thing: disabled the first 4 threads on a specific process.

 

I Hope it is clear...

Thank you for your help. 

 

 

Edited by kamesankamesan
Posted (edited)

Ok, i understand now that 56 threads affinity is 72057594037927935  in decimal number.

But Autoit handle decimal number in 32bits.

So it can't set all cpu affinity...

max seem to be: 4294967295 (32 threads)

 

Any idea?

Thx

Edited by kamesankamesan
Posted (edited)

Hmm, i'm trying a different way.... Correct me please if i'm wrong.

 0x00FFFFFFFFFFFFFF = 56 THREADS?
 0x00FFFFFFFFFFFFFC = 56 THREADS - first 2 THREADS ?
 0x00000000FFFFFFFF = 32 THREADS
 0x00000000FFFFFFFC = 32 THREADS -  first 2 THREADS  ?
 0x000000000000FFFF = 16 THREADS
 0x000000000000FFFC = 16 THREADS -  first 2 THREADS  ?
 0x00000000000000FF = 8 THREADS
 0x00000000000000FC = 8 THREADS -  first 2 THREADS  ?
 

Edited by kamesankamesan
  • Moderators
Posted

kamesankamesan,

Please stick to just the one thread - and certainly do not resurrect any more 9-year old ones.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Sorry to disturb you with my double post 

I tought it wasn't impolite because my problem is no more "all Cpu's affinity except one". I found the way.

But because i use the script from the 9 year old post, i tought it was better to warn there about the uncompatibility with more than 32 cores machine.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...