Jump to content

Why cannot programs be optimized to use more cores so that they are futureproof?

One big argument in terms of optimization of programs or any critical software is that when they were made, CPUs back then only had, say, 4 threads. But now, more than 8 threaded CPUs are very common, which makes your old software you wrote not so optimized as it wasn't designed to use more than 4 threads. But is it so hard to make a performance critical program, such as a game, to first gather the CPU configuration and assign its program threads to how the CPU resources are available? Can it not be programmed in such a way that it dynamically knows what to and how to place tasks on more CPU threads if they are available?

 

I think something similar does happen as benchmarking software always do take the help of all cores, right? And if you had less CPU threads than what the software was programmed for, does it actually re-arrange its program threads according to your CPU configuration, or is it forced by Windows or run stuff on the same CPU thread, as there are no more threads available?

Microsoft owns my soul.

 

Also, Dell is evil, but HP kinda nice.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Hensen Juang said:

One big argument in terms of optimization of programs or any critical software is that when they were made, CPUs back then only had, say, 4 threads. But now, more than 8 threaded CPUs are very common, which makes your old software you wrote not so optimized as it wasn't designed to use more than 4 threads. But is it so hard to make a performance critical program, such as a game, to first gather the CPU configuration and assign its program threads to how the CPU resources are available? Can it not be programmed in such a way that it dynamically knows what to and how to place tasks on more CPU threads if they are available?

 

I think something similar does happen as benchmarking software always do take the help of all cores, right? And if you had less CPU threads than what the software was programmed for, does it actually re-arrange its program threads according to your CPU configuration, or is it forced by Windows or run stuff on the same CPU thread, as there are no more threads available?

A CPU benchmark is quite a lot simpler than an entire game.  More and more games now DO take advantage of higher core counts but it won't be until games are made purely for current gen consoles that we will see a decent boost in CPU / Core usage going forwards as they are running quite similar tech to a decent PC setup in terms of architecture ++.  Its coming along, slowly.

Link to comment
Share on other sites

Link to post
Share on other sites

More threads doesn’t always mean more performance. Idea behind optimization is finding bottlenecks and reducing them, not necessarily just multi threading. 


That whole argument of why nothing is multi threaded is also a thing of 2012. Industry clearly shows an interest towards having more and more threads nowadays.

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

 

Link to comment
Share on other sites

Link to post
Share on other sites

To use more cores you would need to parallelize more and more work and that may not be available to a game engine or an app. Drawing geometry, shading etc can be parallelized and DX12/Vulkan/Metal is quite good and scheduling draw calls via multiple cores. Game logic like current world state and combat is based on conditional calculations and you can't split it as one equation needs the result of the previous one - that's why often games have one "primary" core with higher load and few/multiple with lower load for everything else that can be parallelized. The game may trade consistency for parallelization speed but then gamers would be angry their spell did no damage or it did 10 seconds after it should etc. For single-player games, it could even pass but for anything multiplayer and barely competitive it's pretty much a no-no.

Link to comment
Share on other sites

Link to post
Share on other sites

Parallelism is difficult.  Use yourself as an analogy, can you sleep and eat at the same time?  Not everything can be performed at the same time asynchronously in separate threads.  And when it's possible, not everything divides into an infinite amount of parallel workload, often it's a small number of defined parallel tasks.

 

In reality, a perfect multitasking kernel should be able to run all threads on a single powerful core.  That's kind of how it was in the past.  Multi-core configurations aren't necessarily the ideal solution, they limit your single thread performance when processor time is available.

 

It's not certain that future is always multi-core.  We will hit a performance limit of silicon transistors and designs that can be made with them, but there will be other technologies like room temperature quantum.

This post has been ninja-edited while you weren't looking.

 

I'm a used parts bottom feeder.  Your loss is my gain.

 

I like people who tell good RGB jokes.

Link to comment
Share on other sites

Link to post
Share on other sites

Most games are certainly hard to parallelize, as many things are rendered in real time, even worse for MP where players can interact

It's certainly more feasible for AI and TBS like Civ, but anyway I suppose that most of the low level code involved in multithreading isn't even apparent to game developers, they use engines to code their games and the engine "decides" what to parallelize...

There is certainly tricks/ways of coding that will help but this is a pretty expert skill and can do only as much

 

 

System : AMD R9 5900X / Gigabyte X570 AORUS PRO/ 2x16GB Corsair Vengeance 3600CL18 ASUS TUF Gaming AMD Radeon RX 7900 XTX OC Edition GPU/ Phanteks P600S case /  Eisbaer 280mm AIO (with 2xArctic P14 fans) / 2TB Crucial T500  NVme + 2TB WD SN850 NVme + 4TB Toshiba X300 HDD drives/ Corsair RM850x PSU/  Alienware AW3420DW 34" 120Hz 3440x1440p monitor / Logitech G915TKL keyboard (wireless) / Logitech G PRO X Superlight mouse / Audeze Maxwell headphones

Link to comment
Share on other sites

Link to post
Share on other sites

Software companies are like pharma and would prefer to sell assistance year on year rather than a cure which kills the cash cow..

Multithreading as an option has existed for many years and even though clear advantages were obvious to the industry many developers were happy to simply keep going with what they had for the most part and add updates rather than spend money to rewrite code unless the market forced them to do so. 

I remember the days when one had a license and the model was pay full price for the application and get free updates forever but that was relatively short lived and moved over to the yearly paid updates and finally to the subscription style.

Also improvement to the OS both windows and Mac so often broke apps it was a crazy few years where apps would cease to work until a fix was implemented. Both both Mac and windows still break things but it has gotten better over time but within all of this there is one constant. Tech still outpaces software and future proofing is a misconception and cool for marketing.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Hensen Juang said:

But is it so hard to make a performance critical program, such as a game, to first gather the CPU configuration and assign its program threads to how the CPU resources are available?

Yes. "Assign its program threads" is basically the hardest part of all of this.

It's not done like "if (threads > 4) then do the same stuff but faster".

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×