Jump to content

Test: Setting CPU Affinity


Recommended Posts

I've been going at this issue from all angles I can think of.

 

Basically, from everything I've read, DCS.exe is mutil-threaded. There are two threads. One for the main processing, and one for x-audio. If this were not the case, no amount of setting affinity would make any difference at all, because there would be one processing thread and only one, and at no time could more than one CPU ever be executing DCS code at any one point in time. Everything in this forum-thread goes against that.

 

I have not been able to find any indication that a non-threaded or single-threaded program is anything more or less than program without multiple processing threads. This program's single-thread is no different than any thread from any multi-threaded program(s), other than in the multi-threaded program's own internal threading techniques.

 

If this is true, then in a system with a CPU with HTT (Hyper-Threading Technology), two single-threaded programs can run on the same physical CPU, each on its own VCPU (Virtual-CPU) or LP (Logical Processor), at the same time through the CPU's HTT.

 

Further, Multi-Threaded programs have actually nothing to do with Hyper-Threading CPU's. If I were to turn off HTT in my system's BIO, a multi-threaded programs would still spawn multiple-process-threads, only each would run on a single CPU core all by itself, without hyper-threading allowing a second thread to be stacked into a core's cache for processing at the same time.

 

It may be, that DCS.exe causes other processing to occur outside of its own coding through API- and system-calls, but these are far outside anything one might influence simply through assigning DCS.exe's affinity, and there is practically no way to tweak these, without the help of a Windows engineer trained for doing just that. I work for a computer company, and I know we have engineers who do just that to optimize the running or our SW products far beyond what one might achieve by simply installing our SW on a clean system.

 

So honestly, my current conclusion is that assigning DCS.exe affinity for any two specific VCPU's is only half the issue. The other half would be to prevent any other processes from accessing these two, let's call them DCS-resident, VCPU's in order to prevent any interloping processes from being assigned to the DCS-resident VCPU's and possibly hindering DCS from being processed.

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Link to comment
Share on other sites

No single person understands all this imho. Some more, some less, in the end, they all have to guess, test & verify, but they do not know the outcome before they did a testrun. This is the worst of all that and the reason for myriads of leaks, bugs and incompatibility.

 

HT shows two logical CPUs to the system, but not all programs can make proper use of 2 cores that actually "share" the same "physical" core. Fromm what I know, they need to be pretty similar in tasking, hence my Apache, Chrome, Firefox example. Running two totally different codes one 1 core with 2 logical CPUs does work afaik, but not as good as if both would have their own physical core and not hyperthreaded.

 

Still, all this might be wrong, all I know is that my DCS on ym machine uses 6 REAL cores quite considerably, the other 6 are more or less 0-5% idling. I wonder how I got such good performance with my old 7700k, same 5G, just 2 cores less. It really makes me wonder how PC's with an old i5 will perform. I guess with 2.5 those CPU's are obsolete, they are already now imho.

 

Best you can do, tune your system to 1A condition, have FAST cores, plenty of them, plenty RAM, a beefy GPU and some good SSD/NVMe, maybe 2 of those. Gsync is another good thing to have, goodbye stutter ;)

 

All the rest, is up to the devs.

 

edit:

BTW, a process can splitt into many threads, even on a SINGLE core CPU like an old Pentium-4, look at apache, or pureftpd, real high performance Linux servers. It just makes more sense if you also have multiple cores and can make use of SMP ( symetrical multi processing ). If you dont have dual or more cores and SMP wont work,, hey..you may have Hyperthreading, the little sister of SMP, doesnt work as good and as fast but it is something that often helps, if the software can make use of it. HT = better than nothing, better is real cores, for sure, but HT comes for free, cores dont.


Edited by BitMaster

Gigabyte Aorus X570S Master - Ryzen 5900X - Gskill 64GB 3200/CL14@3600/CL14 - Asus 1080ti EK-waterblock - 4x Samsung 980Pro 1TB - 1x Samsung 870 Evo 1TB - 1x SanDisc 120GB SSD - Heatkiller IV - MoRa3-360LT@9x120mm Noctua F12 - Corsair AXi-1200 - TiR5-Pro - Warthog Hotas - Saitek Combat Pedals - Asus PG278Q 27" QHD Gsync 144Hz - Corsair K70 RGB Pro - Win11 Pro/Linux - Phanteks Evolv-X 

Link to comment
Share on other sites

  • 1 year later...

so I have an i5 6600k, with 4 cores and no hyper threading, when I constrain 2 two cores I *induce* some micro stutters, at three or four cores it goes away (using either autoconfig or process lasso).

 

I think we would have better luck sacrificing chickens on the motherboard ...

SYSTEM SPECS: Hardware Intel Corei7-12700KF @ 5.1/5.3p & 3.8e GHz, 64Gb RAM, 4090 FE, Dell S2716DG, Virpil T50CM3 Throttle, WinWIng Orion 2 & F-16EX + MFG Crosswinds V2, Varjo Aero
SOFTWARE: Microsoft Windows 11, VoiceAttack & VAICOM PRO

YOUTUBE CHANNEL: @speed-of-heat

1569924735_WildcardsBadgerFAASig.jpg.dbb8c2a337e37c2bfb12855f86d70fd5.jpg

Link to comment
Share on other sites

i would not use affinity mask, use ProcessLasso instead and force it to real cores only. IT#s free, its easy to use and if you dont like it, deinstall it.

 

For newer CPU's it really wont matter much but the 4th gen could benefit from that, I do know that 2011 sockets CPU's users had a real benefit from it whereas I dfont see any difference at all, smooth either way.

 

Give it a try ;)

 

P.S. the forum is full of threads with ProcessLasso, search them and read them up if you can

Gigabyte Aorus X570S Master - Ryzen 5900X - Gskill 64GB 3200/CL14@3600/CL14 - Asus 1080ti EK-waterblock - 4x Samsung 980Pro 1TB - 1x Samsung 870 Evo 1TB - 1x SanDisc 120GB SSD - Heatkiller IV - MoRa3-360LT@9x120mm Noctua F12 - Corsair AXi-1200 - TiR5-Pro - Warthog Hotas - Saitek Combat Pedals - Asus PG278Q 27" QHD Gsync 144Hz - Corsair K70 RGB Pro - Win11 Pro/Linux - Phanteks Evolv-X 

Link to comment
Share on other sites

about 16 months back when I was building this rig, I was struggling with DCS microstutters and some odd sound issues. I installed process Lasso and after alot of experimenting, FOR ME, i dedicated Cores 4 thu 7 for DCS as I understood that DCS only uses 1 core but perhaps a 2nd for Audio? Anywho, it resolved my microstuttering and sound issue. I also did some benchmarking to decide if I should or should not use Hyper threading. Using Hyperthreading for me seemed better, so I stuck with that. One thing I think i noticed with process Lasso, it seems like once I create a profile, I have to load it every time I boot up my PC, otherwise its on some some default setting? Good luck sir!

Windows 10 Pro - 64 Bit / ASUS ROG Strix B650E-F Gaming / AMD 7800X3D / G.Skill Trident Z5 NEO 64GB DDR5 6000 Ram / SSD M.2 SK hynix Platinum P41 2TB / MSI Gaming GeForce RTX 4090 SUPRIM Liquid X 24G / SteelSeries Arctis 7 Headset /LG-Ultragear 38" IPS LED Ultrawide HD Monitor (3840 x 1600) / Track IR4 / Thrustmaster TPR Pendular Rudder Pedals / Virpil HOTAS VPC Constellation ALPHA-R & VPC MongoosT-50CM3 Throttle

 

Link to comment
Share on other sites

the operating system is highly tuned to make efficient use of the hardware resources it has available.

 

taking away and limiting resources is not a commonly used way to get a smooth and efficient running system, but heck, odd things happen every day.

it might come down to the other software you have running on the machine and how it interacts with DCS. if that software holds locks or requires exclusive use of finite resources, that might explain it.


Edited by etherbattx
Link to comment
Share on other sites

I have process lasso and I only have real cores

 

wont make much sense then tbh.

Gigabyte Aorus X570S Master - Ryzen 5900X - Gskill 64GB 3200/CL14@3600/CL14 - Asus 1080ti EK-waterblock - 4x Samsung 980Pro 1TB - 1x Samsung 870 Evo 1TB - 1x SanDisc 120GB SSD - Heatkiller IV - MoRa3-360LT@9x120mm Noctua F12 - Corsair AXi-1200 - TiR5-Pro - Warthog Hotas - Saitek Combat Pedals - Asus PG278Q 27" QHD Gsync 144Hz - Corsair K70 RGB Pro - Win11 Pro/Linux - Phanteks Evolv-X 

Link to comment
Share on other sites

wont make much sense then tbh.

 

Okay, thats what I was thinking... Cool

SYSTEM SPECS: Hardware Intel Corei7-12700KF @ 5.1/5.3p & 3.8e GHz, 64Gb RAM, 4090 FE, Dell S2716DG, Virpil T50CM3 Throttle, WinWIng Orion 2 & F-16EX + MFG Crosswinds V2, Varjo Aero
SOFTWARE: Microsoft Windows 11, VoiceAttack & VAICOM PRO

YOUTUBE CHANNEL: @speed-of-heat

1569924735_WildcardsBadgerFAASig.jpg.dbb8c2a337e37c2bfb12855f86d70fd5.jpg

Link to comment
Share on other sites

the operating system is highly tuned to make efficient use of the hardware resources it has available.

 

taking away and limiting resources is not a commonly used way to get a smooth and efficient running system, but heck, odd things happen every day.

it might come down to the other software you have running on the machine and how it interacts with DCS. if that software holds locks or requires exclusive use of finite resources, that might explain it.

 

Generally , yes . But as an example of the occasional failing , i cannot use Intel Turbo Boost since 1809 update .

9700k @ stock , Aorus Pro Z390 wifi , 32gb 3200 mhz CL16 , 1tb EVO 970 , MSI RX 6800XT Gaming X TRIO , Seasonic Prime 850w Gold , Coolermaster H500m , Noctua NH-D15S , CH Pro throttle and T50CM2/WarBrD base on Foxxmounts , CH pedals , Reverb G2v2

Link to comment
Share on other sites

  • 1 month later...

Can someone help me?

 

 

I'm running a i7 4770 which i understand has 4 cores and hyperthreading.

 

 

What should I set my affinity to in the autoexec.cfg?

 

 

I've tried process lasso and using task manager to get DCS to use all cores and I still get awful stutter and freezing.

F-15E | AH-64 | F/A-18C | F-14B | A-10C | UH-1H | Mi-8MTV2 | Ka-50 | SA342 | Super Carrier | Nevada | Persian Gulf | Syria |

Intel Core i7 11700K - 32GB 3200MHz CL16 DDR4 - MSI GeForce RTX 3060 Gaming X 12GB - Samsung 970 EVO Plus NVMe SSD 1TB

Link to comment
Share on other sites

if you dont need hyperthreading turn it off in BIOS … makes things simpler

SYSTEM SPECS: Hardware Intel Corei7-12700KF @ 5.1/5.3p & 3.8e GHz, 64Gb RAM, 4090 FE, Dell S2716DG, Virpil T50CM3 Throttle, WinWIng Orion 2 & F-16EX + MFG Crosswinds V2, Varjo Aero
SOFTWARE: Microsoft Windows 11, VoiceAttack & VAICOM PRO

YOUTUBE CHANNEL: @speed-of-heat

1569924735_WildcardsBadgerFAASig.jpg.dbb8c2a337e37c2bfb12855f86d70fd5.jpg

Link to comment
Share on other sites

This is very interesting, I'm gonna experiment latter with my i7 7700 to see if I see improvements.

 

Beside the advantages it says in the first message, I'll add the there will be more cache hits, since threads come back to the same core when wake up.

 

Should't we also change the affinity of other process, so they don't use the cores reserved for DCS ?

 

 

I'm running a i7 4770 which i understand has 4 cores and hyperthreading.

What should I set my affinity to in the autoexec.cfg?

I guess it would be the same than on my system, but can you run coreinfo on your PC and copy/paste the results here:

 

https://docs.microsoft.com/en-us/sysinternals/downloads/coreinfo

 

the operating system is highly tuned to make efficient use of the hardware resources it has available.

 

taking away and limiting resources is not a commonly used way to get a smooth and efficient running system, but heck, odd things happen every day.

I have seen Matlab simulations run faster limitting it 1 core than in 4 cores ... The operating system doesn't have deep knowledge of the running processes, so it doesn't change its affinity, and if you know all what you have running on your system, you can make fine tunning for just tha case.


Edited by cercata
Link to comment
Share on other sites

You can install ProcessLasso ( PL ) and engage it WHILE you fly, so you see instantly if things get better, stay roughly same, or get worse.

 

What you can do, that's what most DCS Pilots do when they use PL, is to limit DCS to real cores only. I have done that multiple times and for the 8700k or 7700k it made 0 difference. It did iron out some stutter iirc but that is long ago with an older DCS, older 10, older Nvidia drivers, so that cant really be projected to today.

 

Try it out and report back.

 

What I can tell you, more than afew Pilots with v2011 5thgen i7's had stutter and real bad behaviour. They did what is mentioned above and DCS got buttersmooth. Those CPU's also use a TurboBoost the desktop i7 doesnt have ( luckily ). That was/is also a culprit, worse in 1809 as I can read.

 

Anyway, you wont know if you dont do it.

Gigabyte Aorus X570S Master - Ryzen 5900X - Gskill 64GB 3200/CL14@3600/CL14 - Asus 1080ti EK-waterblock - 4x Samsung 980Pro 1TB - 1x Samsung 870 Evo 1TB - 1x SanDisc 120GB SSD - Heatkiller IV - MoRa3-360LT@9x120mm Noctua F12 - Corsair AXi-1200 - TiR5-Pro - Warthog Hotas - Saitek Combat Pedals - Asus PG278Q 27" QHD Gsync 144Hz - Corsair K70 RGB Pro - Win11 Pro/Linux - Phanteks Evolv-X 

Link to comment
Share on other sites

In my i7 7700 (4 physical cores with hyperthreading, so 8 logical cores) I have tryed the following:

 

PHYS  CORE    3    2    1    0
LOGIC CORE   7 6  5 4  3 2  1 0
            1 0  1 0  0 0  0 0  (binary) = 0xA0 (hexadecimal) = 160 (decimal )
            1 1  1 1  0 0  0 0  (binary) = 0xF0 (hexadecimal) = 240 (decimal )
            0 0  0 0  1 1  1 1  (binary) = 0x0F (hexadecimal) =  15 (decimal )

 

 

With "affinity_mask = 160", using 2 cores without HT, I had more sttuters than doing nothing.

With "affinity_mask = 240", using 2 cores with HT, I felt it more smooth than doing nothing, I'm gonna use this.

 

I tested it using mision 7 of the georgian war, a mission with lot of things in the map.

 

I also made a script to set the affinity of other "active" process to the other 2 cores:

 

DCS_Aff.bat

PowerShell "$Process = Get-Process VoiceAttack; $Process.ProcessorAffinity=15"
PowerShell "$Process = Get-Process OVRServer_x64; $Process.ProcessorAffinity=15"
PowerShell "$Process = Get-Process OculusDash; $Process.ProcessorAffinity=15"
Powershell "ForEach($PROCESS in GET-PROCESS Discord) { $PROCESS.ProcessorAffinity=15}"
PowerShell "$Process = Get-Process Steam; $Process.ProcessorAffinity=15"
PowerShell "$Process = Get-Process SteamService; $Process.ProcessorAffinity=15"

 

 

By the way, I could not find a way to change all the other processes to cores 0 thru 3 without changing the rules for EVERY specific process individually? What a pain staking task that was! Do you know of a way to do it say, globally or collectively?

 

Did you find it ? My script could be useful to you if not ...

DCS_Aff.zip


Edited by cercata
Link to comment
Share on other sites

cercata, I did NOT find an easier way unfortunately. I have been following this thread though. Regarding your script, sounds wonderful, however, I have no idea how to implement it or what it all means. I am in no way shape or form a coder.

Windows 10 Pro - 64 Bit / ASUS ROG Strix B650E-F Gaming / AMD 7800X3D / G.Skill Trident Z5 NEO 64GB DDR5 6000 Ram / SSD M.2 SK hynix Platinum P41 2TB / MSI Gaming GeForce RTX 4090 SUPRIM Liquid X 24G / SteelSeries Arctis 7 Headset /LG-Ultragear 38" IPS LED Ultrawide HD Monitor (3840 x 1600) / Track IR4 / Thrustmaster TPR Pendular Rudder Pedals / Virpil HOTAS VPC Constellation ALPHA-R & VPC MongoosT-50CM3 Throttle

 

Link to comment
Share on other sites

I have no idea how to implement it or what it all means. I am in no way shape or form a coder.

You just have to put a line in the .bat file for each process you want to send to the first 2 cores (15 affinity), you can just copy/paste the line multiple times, and change the process name:

 

Powershell "ForEach($PROCESS in GET-PROCESS Discord) { $PROCESS.ProcessorAffinity=15}"

 

We can put process that are not allways runing, it the process is not there, that line just fails, and nothing happens.


Edited by cercata
Link to comment
Share on other sites

Sorry, still lost. I dont even know what".bat" file you are referring to or where it is. The rest is another language to me as well. I have no idea where this stuff is to tinker with. Thanks though

Windows 10 Pro - 64 Bit / ASUS ROG Strix B650E-F Gaming / AMD 7800X3D / G.Skill Trident Z5 NEO 64GB DDR5 6000 Ram / SSD M.2 SK hynix Platinum P41 2TB / MSI Gaming GeForce RTX 4090 SUPRIM Liquid X 24G / SteelSeries Arctis 7 Headset /LG-Ultragear 38" IPS LED Ultrawide HD Monitor (3840 x 1600) / Track IR4 / Thrustmaster TPR Pendular Rudder Pedals / Virpil HOTAS VPC Constellation ALPHA-R & VPC MongoosT-50CM3 Throttle

 

Link to comment
Share on other sites

DO NOT USE AN EXTERNAL CORE SELECTOR, IT CAUSES INSTABILITY. Instead, create an autoexec.cfg file inside the Config folder in the Saved Games folder and use the command "affinity_mask = xx". Replace xx with number found using this website. http://store.fsxtimes.com/cal-cam.php

 

DCS runs best confined to 3 cores, with hyper-threading. Performance per selected cores will vary depending on CPU. I have a 6 core and use "828" so it is using cores 2, 3, and 5 including the HT thread for each.

Intel i9-13900K : ASUS TUF RTX 4080 : 32GB G.Skill RipjawsV 4000 : TM HOTAS Warthog : HP Reverb G2

Link to comment
Share on other sites

Now that is great instructions. Simple to follow, thank you kindly sir. The only thing I found odd was that you mentioned that DCS runs best on 3 cores? My understanding over the years was that DCS primarily ran only one core, and a 2nd was utilized for audio. I’m not saying that is absolute, Im saying that is my current understanding from tons of reading. How does 3 cores come into play? In attrition, if I don’t use PL, what happens to all the other processes, do they continue to use/share the same cores you set DCS too?

Windows 10 Pro - 64 Bit / ASUS ROG Strix B650E-F Gaming / AMD 7800X3D / G.Skill Trident Z5 NEO 64GB DDR5 6000 Ram / SSD M.2 SK hynix Platinum P41 2TB / MSI Gaming GeForce RTX 4090 SUPRIM Liquid X 24G / SteelSeries Arctis 7 Headset /LG-Ultragear 38" IPS LED Ultrawide HD Monitor (3840 x 1600) / Track IR4 / Thrustmaster TPR Pendular Rudder Pedals / Virpil HOTAS VPC Constellation ALPHA-R & VPC MongoosT-50CM3 Throttle

 

Link to comment
Share on other sites

DCS (I think) is still programmed to only use two cores but Windows doesn't know that. I've tested only 1 and 2 cores and you get a drastic loss of FPS, and when running on more than 3 the FPS starts decreasing very slowing but runs more stable. I feel 3 cores works best on my system since I have 6 cores and like to stream. Anyone with a CPU with 8 or more cores should and can set DCS to 4 cores and may have a boost in certain situations. There is very little difference in DCS between using 3 and 4 cores, any more and you're just wasting CPU for other tasks.

 

I don't know how project lasso works but I assume until you command it to manage core usage for a program it won't do anything else to other Windows processes.

Intel i9-13900K : ASUS TUF RTX 4080 : 32GB G.Skill RipjawsV 4000 : TM HOTAS Warthog : HP Reverb G2

Link to comment
Share on other sites

Test: Setting CPU Affinity

 

DCS uses threads to execute its tasks, it’s those threads that are scheduled, by the operating system, to run on a core(s).

 

DCS has many threads but uses 3 threads for most of the work.

 

enabling hyperthreading just means the operating system can schedule more than one thread onto the same core. it’s useful if you are core limited and don’t have enough cores for the threads to use, but keep in mind a core can only do one thing at a time. if you schedule two threads into the same core, one of them has to wait for the other.

 

i am surprised you see better performance by limiting the cores (compute resources) you are allowed to use.


Edited by etherbattx
Link to comment
Share on other sites

Hmmmmm,, I will have to fiddle with this. Thanks

Windows 10 Pro - 64 Bit / ASUS ROG Strix B650E-F Gaming / AMD 7800X3D / G.Skill Trident Z5 NEO 64GB DDR5 6000 Ram / SSD M.2 SK hynix Platinum P41 2TB / MSI Gaming GeForce RTX 4090 SUPRIM Liquid X 24G / SteelSeries Arctis 7 Headset /LG-Ultragear 38" IPS LED Ultrawide HD Monitor (3840 x 1600) / Track IR4 / Thrustmaster TPR Pendular Rudder Pedals / Virpil HOTAS VPC Constellation ALPHA-R & VPC MongoosT-50CM3 Throttle

 

Link to comment
Share on other sites

  • 1 month later...

What does everyone use for settings on the rest of the windows o/s processes that are running? Are they left at default?

Intel 13900k @ 5.8ghz | 64gb GSkill Trident Z | MSI z790 Meg ACE| Zotac RTX4090 | Asus 1000w psu | Slaw RX Viper 2 pedals | VKB Gunfighter Mk3 MCE Ultimate + STECS/ Virpil MongoosT50+ MongoosT50CM |Virpil TCS+ AH64D grip + custom AH64D TEDAC | HP Reverb G2 | Windows 11 Pro | |Samsung Odyssey G9 | Next Level Racing Flight Seat Pro


 My wallpaper and skins

Link to comment
Share on other sites

×
×
  • Create New...