Maximilian 25 Report post Posted May 29, 2017 I am wondering if it is possible to edit the start.bat in such a way that every new Game.exe client opened is automatically set to have an affinity with the least busy CPU core. I realized while playing with many clients open that while the game lagged considerably with both CPU and RAM being under 50% usage , on further investigation i realized that one single core (the 0th) was doing all the work , processing for all the eleven clients i opened. Now , the fix was fairly trivial , going on task manager and setting the affinity for every game.exe to a different CPU core. Once i did so the lag completely disappeared. Doing so manually is a bit of a chore , and more importantly i often forget to do so. Is there a way to set the start.bat to recognize the affinities of the other game.exes and automatically setting the new process affine to the Core that has the least number of processes affine to it? Thank you in advance. And example : I have a 4 core CPU , 1st game, exe would be affine to CPU 0 , 2nd to CPU 1 , 3rd to CPU 2 , 4rth to CPU 3 , and then start repeating. Quote Share this post Link to post Share on other sites
Billy 164 Report post Posted May 29, 2017 https://www.eightforums.com/tutorials/40339-cpu-affinity-shortcut-program-create-windows.html 1 Quote Share this post Link to post Share on other sites
Maximilian 25 Report post Posted May 29, 2017 10 minutes ago, Billy said: https://www.eightforums.com/tutorials/40339-cpu-affinity-shortcut-program-create-windows.html Thanks , however in my preliminary search I had arleadly found that method and didn't find it satisfactory. The main problem is that it would require a different shortcut for every affinity i wanted , so four shortcuts in my case (unless i misunderstood something), i would like one single start.bat that automatically determined which Core has the least number of game.exes running on it and it executed the new game.exe with that particular affinity. I hope i'm being clear enough , if i need to rephrase just ask Quote Share this post Link to post Share on other sites
Billy 164 Report post Posted May 29, 2017 @ECHO OFF :: Declare amount of cores SET /A maxcores=4 :: Declare path to game.exe SET gamepath="system/game.exe" :: Declare game.exe name SET game="game.exe" ::Count current instances of game.exe ::Write number to tmp file. tasklist | find /I /C %game%>tmp ::Read in number from tmp file. SET /p count= <tmp ::Get modulous of count and maxcore. ::We use this to decide which core to run on. SET /A core=(%count% %% %maxcores%) SET coreparam=1 ::If there are no other clients open, ::Always run on core 0 (coreparam = 1) IF %core%==0 GOTO run ::Loop for exponent SET loop=0 :multiply SET /a coreparam=coreparam*2 SET /a loop=loop+1 IF %loop% LSS %core% GOTO multiply :run ::Run game.exe and set affinity. cmd.exe /c start "Process Monitor" /affinity %coreparam% %gamepath% startgame Can try something like this. 3 Quote Share this post Link to post Share on other sites
Sultan 68 Report post Posted June 1, 2017 I'm quite interested in this thread, mind explaining what it does? Thanks a lot Quote Share this post Link to post Share on other sites
Simon 76 Report post Posted June 4, 2017 This topic seems really interesting,have you gotten to a solution @Maximilian? @V3ct0r Quote Share this post Link to post Share on other sites
Maximilian 25 Report post Posted June 5, 2017 Yes , it works as intented. The only thing you have to be careful about is that if you close clients , the order continues to be the same, it doesn't fill the "hole". So if you have 4 open on 0 1 2 3 , close the last two 2 3 , and open two more , they will be on 0 1 as the first two. However it works really well. Note : if you want to use it too , check how many cores your CPU has , and edit the "4" to be your number. 1 Quote Share this post Link to post Share on other sites