Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Processor Affinity  (Read 2912 times)

0 Members and 1 Guest are viewing this topic.

Captain Dawson

  • member
  • Offline Offline
  • Posts: 511
Processor Affinity
« on: January 01, 2017, 03:49:31 PM »

Hello chaps,

I read a page on the internet that said I can assign certain CPU cores to specific programs. This is called Processor Affinity. You do this in the Win10 Task Manager settings. Supposedly you can do this in order to take some of the load off a particular core and use it only for the program you need more performance in, such as IL-2.

So I have 4 cores on my new Intel i5-6600K CPU. (No Hyper-threading) They are listed as 0, 1, 2, and 3. The operating system apparently runs on the first core, (core 0?) so I assume I should not mess with it...   :P  How specifically should I go about prioritizing IL-2? Can I set all my Win10 "apps" to not use core 3 and set it only on IL-2.exe, or will that screw stuff up?

IL-2 isn't optimized for multi-threading, but it is set to use all CPUs by default. Is it better to use it with a single CPU untainted by other apps affinity?

I have never done this kind of stuff before, so I don't really know what I'm doing. All I know is what I read on the internet.  :D
Any tips optimizing this would be much appreciated!
Logged
"It's totally foolproof, until you mess something up." -Captain Dawson My OP rig: CybertronPC Palladium custom desktop computer, GPU: NVidia GeForce GTX 1060 6GB GDDR5, CPU: Intel Core i5-6600K 3.5 GHz 6M Cache Skylake Quad-Core, RAM: 8.00 GB, Motherboard: Intel H110 Chipset, SSD: 240GB, HDD: 1TB, OS: Windows 10

SAS~Storebror

  • Editor
  • member
  • Offline Offline
  • Posts: 23610
  • Taking a timeout
    • STFU
Re: Processor Affinity
« Reply #1 on: January 02, 2017, 01:28:16 AM »

In a nutshell: Don't touch it. It won't get better. At best, you won't notice any difference.

In detail:
The ProcessAffinityMask for IL-2 can be set in conf.ini.
You can do it manually or use this tool: https://www.sas1946.com/main/index.php/topic,32520.0.html

The Operating System runs on all available cores, not just on Core 0.
It distributes processes across cores as it sees fit.
You cannot "exclude" a certain core from this process distribution (at least not as much as I know).
You can "pin" IL-2 to a certain core (or certain cores) using the ProcessAffinityMask setting and if IL-2 fully occupies this (these) core's resources, Windows will automatically try to run other procresses on other cores.

Theory and Practice:
IL-2 doesn't have multithreading capabilities builtin, hence it cannot make use of multiple cores to enhance the game's performance.
That's why for IL-2's performance CPU-wise only the single-thread performance is what counts.
In theory this means that when you let Windows decide on which core IL-2 should run, Windows will "distribute" the IL-2 process across all cores.
How can that be if IL-2 isn't multithreading capable?
Well, the Windows Kernel provides pretty small timeslices for the execution of processes, and it will simply let the main IL-2 process cycle across all available cores, so it will consume a single micro-time-slice on each core and then continue to execute on the next.
In theory this means a performance disadvantage, since there's a certain overhead required to shift a process from one core to another.
However this overhead is extremely small on contemporary processors, it's well below 1% of the core's power.
In practice IL-2 isn't exactly single threaded, at runtime you will have about 15-20 threads attached to the il2fb.exe process.
The thing is that all but one of these threads are inactive (in "wait" state) most of the time and only one thread (the main thread) is consuming all the power.
Still there are other threads, so pinning the il2fb.exe process to a single core means that all these threads are bound to that core.
In practice the processing power required by the "other" 14-19 threads is higher than the overhead required to shift the main thread across the cores.
That's why pinning il2fb.exe to a single core actually causes a very tine performance degradation instead of making things better.

Theory²:
Theoretically the best setting would be to run IL-2 on 2 cores (one for the main thread, one for the others) and to pin the main thread to one of these two cores.
This however would require a tool to set the affinity for threads and not just for processes.
I don't know of a system wide tool to provide such feature and if it exists, it will be a PITA to handle this each and every time when you start IL-2.
It would be possible (theoretically) to create a native mod for IL-2 to do this, but then again, we're talking about a 0.000x% performance margin only.
Not worth the hassle if you ask me.

Best regards - Mike
Logged
Don't split your mentality without thinking twice.

hguderian

  • Modder
  • member
  • Offline Offline
  • Posts: 1136
Re: Processor Affinity
« Reply #2 on: January 02, 2017, 07:46:25 AM »

Hi!

This could be the tool you need to pin the affinity:

http://www.bill2-software.com/processmanager/download-en.shtml

I'm using bill2 process manager to isolate IL2 on 2 of my 4 cores (2th&3th).

Give it a try.

Regards
Logged

SAS~Storebror

  • Editor
  • member
  • Offline Offline
  • Posts: 23610
  • Taking a timeout
    • STFU
Re: Processor Affinity
« Reply #3 on: January 02, 2017, 08:38:17 AM »

As mentioned before, pinning the process of IL-2 to specific cores is absolutely useless.
At best, it will show no effect at all.

Bill2's Process Manager, as any other such tool available thousands of times on the internet, doesn't give you the ability to pin specific threads of processes to specific cores, hence it's as useless for the desired task as all others.

Best regards - Mike
Logged
Don't split your mentality without thinking twice.

Captain Dawson

  • member
  • Offline Offline
  • Posts: 511
Re: Processor Affinity
« Reply #4 on: January 02, 2017, 11:14:29 AM »

The ProcessAffinityMask for IL-2 can be set in conf.ini.
You can do it manually or use this tool: https://www.sas1946.com/main/index.php/topic,32520.0.html

I have already done this, thank you.


In a nutshell: Don't touch it. It won't get better. At best, you won't notice any difference.

The Operating System runs on all available cores, not just on Core 0.
It distributes processes across cores as it sees fit.
You cannot "exclude" a certain core from this process distribution (at least not as much as I know).
You can "pin" IL-2 to a certain core (or certain cores) using the ProcessAffinityMask setting and if IL-2 fully occupies this (these) core's resources, Windows will automatically try to run other procresses on other cores...

As mentioned before, pinning the process of IL-2 to specific cores is absolutely useless.
At best, it will show no effect at all.

That makes sense. Thank you for your replies! I see now I should concentrate on other areas to optimize IL-2.


Logged
"It's totally foolproof, until you mess something up." -Captain Dawson My OP rig: CybertronPC Palladium custom desktop computer, GPU: NVidia GeForce GTX 1060 6GB GDDR5, CPU: Intel Core i5-6600K 3.5 GHz 6M Cache Skylake Quad-Core, RAM: 8.00 GB, Motherboard: Intel H110 Chipset, SSD: 240GB, HDD: 1TB, OS: Windows 10
Pages: [1]   Go Up
 

Page created in 0.089 seconds with 26 queries.