Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

User:Handlingcfg/Multi-Threading on game performance

From PCGamingWiki, the wiki about fixing PC games
Revision as of 15:56, 9 March 2022 by Handlingcfg (talk | contribs)

Multi-Threading programming is a technique for running multiple code instances on different threads (workers).turning smt on-off and setting affinity can affects games performance.

a quick test about cpu affinity on far cry 3 (2013)


optimal (lowest) graphic settings and 720p resolution, cpu ryzen 5 3600@4300 mhz + amd rx 5600 xt + 32 gb ram + w10 21h2

FPS Number of Threads-Cores
20-21 1 core
63-64 1 core + smt
79-80 2 core
142 3 core
89-93 2 core +2 smt
139-141 4 core
124 6 core
110-111 6 core+6 smt


another quick test on another scene

FPS Number of Threads-Cores
157-161 3 thread smt/off
178-182 4 thread smt/off
188-190 5 thread smt/off
198-200 6 thread smt/off
143 4 thread smt/on
172 5 thread smt/on
167 6 thread smt/on
151 12 thread smt/on


The best affinity varies on either is smt on or off


Modern cpu's have different units for different calculations. on each cpu core, different units can be used simultaneously for different codes. intels Hyper-Treading and amd's Simultaneous MultiThreading technologies uses this technique. On each cpu core, there are 2 logical cores (threads). if 1 thread is waiting for data from ram or idleing for another reason, the second code runs on the real core in that time period.


very old games designed to work on only 1 thread, after about 2005, the never games designed to 2 thread, than 3-4-8-16-20 etc... modern and demanding games tend to work same or lose performance with turning on-off smt or setting affinity with todays cpu's (in 2022, biggest consumer cpu is 5950x-16 real+16 logical cores)


the performance of very old games (games need 1 core), doesnt affected. however some games dont run or runs problematic with more thread affinities and they may need to run on only single thread.


on the games from 2005 to 2018, their performance can be varied by number of threads they are on running

when a game runs on windows, windows runs the game code on all threads, if game use less than the avaible threads, windows runs code 1 on thread1, than runs code2 on thread2... etc+


when windows runs code on a core and moving code from another core, on hardware level, each register and flags need to be copied to new core, therefore some performance lost on moving. additionally each core could has individual cache, (cache is like 1000 times faster ram and stores the most used data) the new core needs to build same cache again.


in conclution, some games runs fastest on specific thread configration, for 2005-2018 era, disabling smt from bios needed for the best performance. alternatively, cpu affinities can be set. with affinity set method, %95-%99 of the best performance could be achieved in generally.

each game requeres specific number of cores, ie: far cry 3 runs best on 3 or 4 actual cores. in this example, 4 is recommended because in some areas on map, game may need more cpu power.



-cpu0 and cpu1 represents actual core1, both belongs to core1, if 1 code runs on cpu0 or cpu1, it actually runs on actual core1 (if doesnt matter if it runs on cpu0 or cpu1) if cpu1 selected for program to run, cpu2 becomes smt part for cpu1 and both works goes to actual core1 -if 2 different codes runs on cpu1 and cpu 2, in reality they are running on core1, so 1 thread must wait for some time to be finished. although this seems like non-logical,about %30-40 percent more code runs on same time by this technique .


for running far cry 3 optimally on windows, game code needs to run on 4 (or 3) actual threads, cpu0+cpu2+cpu4+cpu6 or cpu1+cpu3+cpu5+cpu7 needs to be selected. [set affinity]