kamesankamesan

All CPU Affinity except one

9 posts in this topic

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.

 

 

Share this post


Link to post
Share on other sites



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.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

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.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#4 ·  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

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

#6 ·  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

Share this post


Link to post
Share on other sites

That seems to  be exact but unfortunantely it can't parse more that 32 THREADS again...

0xFFFFFFFF is max. I suppose for the same reason: autoit int32 numbers..

Share this post


Link to post
Share on other sites

kamesankamesan,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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