Limited by Main Thread Question

I’m not an expert on all the multi-threading stuff and how a program schedules work to cores/threads, but maybe you all know. I’ve been browsing the related topics in the forums about others getting “limited by main thread” on their FPS counter, and I noticed that I have one core/thread that’s 100% while the other 19 are some much smaller amount:

I’m on mostly ultra settings with a lowly 1080Ti, so getting almost 40fps over a small city is fantastic for me. I have no issues with the FPS I’m getting. It’s more the why on this threading stuff. What I’m assuming is because one core/thread is tapped out at 100%, rather than loading the others, the game just gives up and says there’s no more CPU power?

I’ve read on another post, or perhaps a link from that post to somewhere on the internet, saying perhaps this was a function of the game using DirectX 11 and that maybe the update to 12 would do things differently? But it was only a thought from someone rather than fact.

I guess my question is more technical. What is preventing the game from simply going to other under-utilized cores/threads? Is this just game code that isn’t robust yet, or is it a limitation of DX11?

I’ll field this one. For reference, I do simulation development for the day job. I’d say it fundamentally isn’t a question of “robustness” nor DX11/12.

Certain computational tasks lend themselves to parallel computing, some do not.

As a real life example… let’s say you’re a student and you have a homework assignment of 5 math problems to do. You can either do them all yourself, or you can email 4 friends of yours an have them each do a problem, and you all share your answers at the end.

Which way is faster? It depends, right?

If each problem only takes about a minute to do, you’ll be faster just doing them all yourself, “on a single core.” You’d be done in 5 minutes, whereas it might take 10 minutes total to send your email out, have everyone get around to doing their problem, and email it all back to each other.

If each problem took a day to do, then you’d be way faster splitting it up amongst the friend group because the time spend emailing each other is WAY smaller than the computation time.

Even then, you run into a situation where… let’s say you use the answer from Problem 1 to go into Problem 2, and then the answer for Problem 2 is a start point for Problem 3. Now you’re back to it being no faster to split the work up because each problem is linked to the one preceding it. You’d have “cores” just sitting around because they can’t do their job until they know something else first.

Whether or not parallel computing is worth it tends to come down to the type of problem, and how long the computation time is vs. the communication time.

Getting back to programming now, early during the Covid-19 stuff I was stuck at home and “off” work. Being bored, I wrote some software to analyze Covid case data day-to-day as it was put out in a centralized repository. If I have 100 data files, one for each day’s data of infections, that’s a good parallel task to analyze them simultaneously because none of them depend on any other. They are entirely self-contained, and each one takes a non-trivial amount of time to parse.

In the case of a flight simulator or racecar simulator or similar, there’s much less opportunity for parallelism. You are marching through time with the physics engine, sometimes 0.001 seconds at a time. I can’t solve 0.002 seconds in the future until I know 0.001 seconds in the future, and I can’t solve 0.001 seconds in the future until I know the answer for the current instant in time. This is an inherently series calculation, marching ahead in time, solving all the aircraft physics as you go. Each solution in time is linked to the one preceding it.

There’s the potential to split the problem up across cores though. You could have lift and drag being computed on Core 1, engine power computed on Core 2, and avionics control on Core 3. But! There’s a penalty in that it takes time for the cores to communicate their answers to each other before they can march forward. Sometimes an appreciable amount of time if you’re computing things hundreds or thousands of times a second. You might find that you’re slower by splitting it up, much like in the homework example before.

I can’t speak specifically to the ins and outs of MSFS as I’m not a developer for it. But that’s the general background for simulation and parallelism. Sometimes it makes sense, sometimes it doesn’t.

Great explanation! Digestable for everyone.

as @Hester40MT already mentioned..

Use the forums search function and you find enough discussion thread in which you can join.

In special the one-core-usage is mentioned, lots of time.

SIMPLE and easy search with your own keywords:

https://forums.flightsimulator.com/search?q=Limited%20by%20Main%20Thread

PS.: can’t understand why users create again and again for the same thing a new topic !

No one needs to be an expert in multi-threading or graphics computing to have an excellent experience using MSFS. There are enough general settings (low, medium, high, ultra) and defaults available that can and should be used without having to understand the underlying details. And there are plenty of parameters that can be adjusted and tweaked for advanced users. There are tools such as the FPS counter that give some insight into how things are running.

The FPS counter in the developers menu is primarily for developers although accessible by all users. Unfortunately, many users have a goal to have 60, 90, or better FPS. Their primary focus is resolving “the bottleneck”. However, computers and applications always have some sort of bottleneck such as hardware, software, peripherals, network, operating system, or application code.

Looking at your specific FPS snapshot, it does show that the primary bottleneck is the “main thread” but looking at the overall performance the GPU processing time is almost the same as the CPU. If the “main thread” bottleneck is “fixed”, the GPU will become the next bottleneck without much improvement in FPS. It appears from your screenshot that your system is well balanced between the CPU and GPU. It is possible to adjust various parameters to give you more FPS or to give you better quality graphics. Only you can decide your satisfaction with MSFS.

Thank you, Tom! That’s what I wanted to know and was an excellent example.

Thanks for the suggestion, Hester. However, as I mentioned I didn’t see the information I was after in the forum already. As your link indicates, a search for limited by main thread returns results about live weather issues, log book issues, etc. I am not sifting through unrelated titles on the off chance somewhere within them someone mentions a main thread. Hopefully that also explains it for whiny users such as michaMMA.

Thanks again, TomZ85!

Indeed. “The Mythical Man Month” needs a sequel… “The Mythical Multi Core Clock cycle”