Was taking a look at Process Lasso after seeing a video that @wendell did.
He was talking about using scripts to do the same.
Process Lasso is find, but would rather us scripts and have one less program running in windows.
What I want to do is define the cpu cores that are used by the program, and Priority level of said program.
I have in the past tried to look up how to do this and it turns into a rabbit hole of going no were for me.
Does anyone know of a simple how to make an new icon for a program that will run the script that I want. I just want this to be double click icon script runs the script.
In a recent video, possibly the same one, he also mentioned using powershell to accomplish exactly this. I do not know how to do this, or if that can be turned int an executable but my understanding is that powershell is like turbo command prompt so you should be able to make an executable file with the powershell commands in it to start the game and run it on the correct cores.
I defer to more knowledgeable people, but you should at least have a direction to look in.
You are right it was using poweshell.
Thanks
This difference between powershell, scripts and terminal commands, I have no idea.
I have used scripts in linux to run multiple terminal commands but thats all I know.
How it would working in windows that I do not know.
Making powershell scripts executable (it’s a PITA, I’m guessing it’s a security thing for users who don’t know what a .ps1 file is):
Setting processor affinity:
It seems to me that the “right” thing to do would be to make the powershell script that runs said program, then sets its affinity. Then adjust your launcher to run the powershell script instead of the program. That way you don’t have two double clicks. Cause clicking 4 times is just, well, that’s a full days work.
LOL
Thanks for the info
The second link you have, I tried to read it and did not get any where with it, I like to understand commands before using them.
This would explain why Process Lasso is around do this sort of thing is not for the average windwos user.
Unless there is other info will stick to Process Lasso.
Have a day
$thisProcess is Storing a Process in a Variable for later use. Here is the definition for the “Process Class”. With the :: you are using a Method of that Class. Other options would be GetProcessById and GetProcessByName.
Under Properties you can find what you can set those to. Setting properties in Powershell is done by appending the desired Property with a Period. So $thisProcess.ProcessorAffinity $thisProcess still holds an Object of Type “System.Diagnostics.Process” and addresses the Property “ProcessorAffinity”. It’s then set to “0x1”, which is the Bitmask representation für Core 1. The Link Above does a great job explaining the Bitmask. In short: you have 16 bits (00000000 00000000), each zero representing one core. You set the bits corresponding to the cores you want to 1. So for cores 1, 3, 5 and 7 its 00000000 01010101. Then convert that to Hexadecimal (55) in this case. So to set an Affinity to those cores you run $thisProcess.ProcessorAffinity = 0x0055
I’m not 100% how it handles non multiples of 8 Cores. So with a 12 core system, is it 00000000 00000000 00000000 and the most significat 4 bits get ignored, or is it just 0000 00000000 00000000? In any case, after Conversion to Hexadecimal it doesn’t matter. Leading Zeros have no impact on the outcome.
If you have any more questions concerning this, the Get-Process Alternative or Powershell in General, feel free to ask. You could even script this to run interactive in Powershell and you entering a comma-seperated List of Cores, and it doing the conversion for you…
One can also make use of the fact that a game launched from another program like Steam or Origin, inherits the same processor affinity. For instance I start Steam with a simple batch file containing the following line:
start /affinity 5554 steam.exe
With the same batch file placed in the program folder of Steam. It’s a lazy but efficient way and most modern games will run fine with the same affinity setup as which works well for another on a particular system.
(The numbers after “/affinity” are similarly as earlier in the thread, a Hex expression of a Binary number, in this example the binary “0101 0101 0101 0100”, which leads to an affinity that skips the first core and then populates one thread per the following core of an 8 core 16 thread CPU.)
Fx 8350 cpu trying to get the Binary for using cores 2,3,4,5,6,7 on and 0,1 off
the number I get is 252 but that gets me cores 1,4,6 on.
Not getting the right number to get the right cores to run.
Binary 11111100 = 252
Missing something.
Thanks that worked
Just wondering why FC and not 252?
Trying to get an understanding of this so if there is a need to have just core 6,7 or 2,3,4,5 and other combinations to work, how to find the right number.