KLEERi1 Jan 1, 2023 @ 4:09pm
Understanding how threads are used in games (question)
Please correct my assumptions ...

If a game uses only single threading, does that mean it uses one thread at a time, or only one thread period?

I am assuming that singe thread use games implies it doesn't facilitate the use of 'hyper-threading' (combing threads to use together).

SOOOO if a game runs utilizing single threads, then it will use all 8 threads on a CPU that is 8 cores and 8 threads, and if the CPU is a 8 core 16 thread it will be able to use up to 16 threads to carry out game calculations? IF correct does this mean all games are able to use all 8 or 16 threads (or more) that the CPU has, or are many software/games only able to utilize a finite number of threads period, regardless of how many the person's CPU has (so each game would then differ based on it's program platform/coding engine etc.)???
< >
Showing 1-15 of 22 comments
Overseer Jan 1, 2023 @ 4:48pm 
The code games are written in does not specifically dictate the amount of cores being used, because that would be a dumb way to scale a program. The Windows Scheduler will attempt to spread the workload (threads) across all available cores. Each thread the game queues will be handed to an available core. But even if the workload is spread each individual thread could have to wait for data some other core is working on, limiting the frames per second as a result. And running the whole workload on the same core could just be as effective.
If people speak of optimization and better core usage of 4 to even 8 cores it simply means the developers detached thread dependencies in efficient ways that the wait time is minimized to draw a frame.
Any application has a main thread and eventually child threads . Which on their side can have their child threads as well and so on . So an application can consists of many threads , Lets assume the CPU has 8 cores and supports Hyperthreading . Thus it can handle 16 threads of execution at any time . The OS decides which application thread to run on which processor core -real or virtual . A lot of games have lots of threads . For instance 20 . Keep in mind the number of threads can vary over the time an app has been running
Last edited by smallcat; Jan 1, 2023 @ 5:21pm
KLEERi1 Jan 1, 2023 @ 5:31pm 
Originally posted by smallcat:
Any application has a main thread and eventually child threads . Which on their side can have their child threads as well and so on . So an application can consists of many threads , Lets assume the CPU has 8 cores and supports Hyperthreading . Thus it can handle 16 threads of execution at any time . The OS decides which application thread to run on which processor core -real or virtual . A lot of games have lots of threads . For instance 20 . Keep in mind the number of threads can vary over the time an app has been running

So on a game like DSP (which I do not know if utilizes hyper-threading tech), where there are a ton of calculations (both CPU and GPU) a CPU with 12 core and 24 threads would be able to use at least 12 threads for those calculations (vs. 8 like my 9700K has currently)? ((not taking into account how fast one vs another CPU is able to do them via respective speed/freqequency))
Last edited by KLEERi1; Jan 1, 2023 @ 5:31pm
The application itself determines the number of threads that uses . This number can vary over the time of running. A CPU with 12 C/24T can execute only max 24 threads of all processes at any time . But as we have GHz processors i.e. many cycles , they can handle thousands of threads per second .

edit
12 cores 24 threads , think of the CPU as 12 real cores and extra 12 virtual or 24 cores in total that can handle 24 threads at any time , these threads can belong to one or more applicatios/processes

processors have cores , applicattions have threads
Last edited by smallcat; Jan 1, 2023 @ 6:13pm
Overseer Jan 1, 2023 @ 6:13pm 
It doesn't matter how many calculations a thread has in store. If the thread takes too long it will run out of quantum and will have to wait on the side. Don't confuse threads a CPU can actively process with threads a process announced to the scheduler.
KLEERi1 Jan 1, 2023 @ 6:15pm 
Originally posted by smallcat:
The application itself determines the number of threads that uses . This number can vary over the time of running. A CPU with 12 C/24T can execute only max 24 threads of all processes at any time . But as we have GHz processors i.e. many cycles , they can handle thousands of threads per second .

edit
12 cores 24 threads , think of the CPU as 12 real cores and extra 12 virtual or 24 cores in total that can handle 24 threads at any time , these threads can belong to one or more applicatios/processes

processors have cores , applicattions have threads

Clearly put thanks
The confusions come that we read threads for processors . In fact processors have cores , application have threads which are executed on the cores . Thread is a sequence of code
KLEERi1 Jan 1, 2023 @ 6:16pm 
Originally posted by smallcat:
The application itself determines the number of threads that uses . This number can vary over the time of running. A CPU with 12 C/24T can execute only max 24 threads of all processes at any time . But as we have GHz processors i.e. many cycles , they can handle thousands of threads per second .

edit
12 cores 24 threads , think of the CPU as 12 real cores and extra 12 virtual or 24 cores in total that can handle 24 threads at any time , these threads can belong to one or more applicatios/processes

processors have cores , applicattions have threads

Anyway to find out how many threads Dyson Sphere Program is utilizing?
Resource Monitor, tab CPU
Last edited by smallcat; Jan 1, 2023 @ 6:19pm
KLEERi1 Jan 1, 2023 @ 7:04pm 
Originally posted by smallcat:
Resource Monitor, tab CPU

THANKS - 92 threads and CPU 41% - Average: 41%. So seeing this and the CPU is a non-hyper thread i7-9700k 8 core, does this mean that Dyson Sphere Program is only utilizing 42% of the potential of the CPU (less what the other processes are using from that '100%' potential)? Am trying to find the bottle-neck to low FPS and not sure if it's CPU, GPU or other.

Also what is the PID figure in the field before the applications name ? (for Dyson Sphere Program that value is 7024)
_I_ Jan 1, 2023 @ 7:06pm 
windows scheduler does a good job at spreading out core/thread loads

if a game uses one thread on a 4 core cpu, it will use 1/4 = 25% max
if its 16 thread cpu, 1/16 = 6.25% max

games that can use more cores/threads will not always use them, and are still limited by the games main thread

its way easier to see cpu bottleneck by looking at gpu usage
basically if its not limited by vsync or game engine and gpu is not at 95-100%, its the cpu limiting it
Last edited by _I_; Jan 1, 2023 @ 7:12pm
Each process running in Windows is assigned a unique decimal number called the process ID (PID)

Might try GPU Z which can show any performance cap , if imposed .
Last edited by smallcat; Jan 1, 2023 @ 7:24pm
KLEERi1 Jan 1, 2023 @ 7:25pm 
Originally posted by _I_:
windows scheduler does a good job at spreading out core/thread loads

if a game uses one thread on a 4 core cpu, it will use 1/4 = 25% max
if its 16 thread cpu, 1/16 = 6.25% max

games that can use more cores/threads will not always use them, and are still limited by the games main thread

its way easier to see cpu bottleneck by looking at gpu usage
basically if its not limited by vsync or game engine and gpu is not at 95-100%, its the cpu limiting it

Well GPU may be it (in spite of it only being around 75% in task manager) ... the CPU's UPS (not sure what that is) is down to 38 in the Stats Panel in game. Someone said that if that figure is below 60 then then the GPU may be the bottleneck. Can this be the case even though it's not showing near 100% in task manager (is this GPU figure in task manager in regards GPU's memory used?)
KLEERi1 Jan 1, 2023 @ 7:25pm 
Originally posted by smallcat:
Each process running in Windows is assigned a unique decimal number called the process ID (PID)

Might try GPU Z which can show any performance cap , if imposed .

Will look into it thanks again for pointers
If V-Sync is enabled either in the game itself or in the video driver , it can limit the GPU utilization . Overheating of CPU/GPU can be another reason .
< >
Showing 1-15 of 22 comments
Per page: 1530 50

Date Posted: Jan 1, 2023 @ 4:09pm
Posts: 22