WelcomeUser Guide
ToSPrivacyCanary
DonateBugsLicense

©2024 Poal.co

715

(post is archived)

[–] 1 pt (edited )

As an American programmer, this isn't about being smart or stupid... it's about being greedy.

Back in the day there were no parallel processes, no background tasks, and definitely no threaded cores. You had one program, it only ran when it was open, and that was it. That program got what is available, and nothing more. Things were simple.

Nowadays, there are background tasks, parallel programs, and layered windows all doing their own work behind each other... hell, your web pages are written in Angular, which is essentiall just a JavaScript program that runs through your browser, so if you have 10 tabs open to pages that run Angular, your have 10 + 1 programs (Angular plus the browser) running at the same time!

And this is where greed comes into play. With single-process machines, the only had a certain amount of memory to "play" with... any more and the machine would crash. But now, when you have gigabytes of memory, how much does your browser get? How much does your Micro$oft Office suite get? How much memory goes to your calculator program?

And, more importantly? What happens when every program wants it all? The resources are there, and those resources are available, but what happens when each program wants all of it?

This is what "paging" and "SWAP space" is. If any of you lived through Winb£ows X₱ or Vi$ta, then you may remember using a USB flash drive to "increase your paging memory" to "increase SWAP performance". Your OS will routinely take applications you're not actively using, or it thinks you're not actively using, and pull it's RAM contents out of RAM and write them to the SWAP space on your hard disk (which is SLOW), as a "page" of memory... or if you had a USB 2.0 flash memory device (which is faster than writing to a spinning hard disk) it could write your "pages" to that.

Now, once an app has been SWAP-ped to the HDD/USB, if you ever want to pull that app to the front again, your computer now has to take the app that was just in the front (the one you're no longer using), send its page to that SWAP space on the HDD/USB, pull the page for the app you want to use out of SWAP, and put it back into RAM. This isn't a trivial process, and it takes time...

Unless you have enough memory to run both (or all of your) apps at the same time... then there's no need for this SWAP-piness to take place. Everything can live in RAM, and you're blazing fast... unless developers hear the new standard is 64GB of RAM, and they start putting more "features" into their programs, which require more RAM, because they're greedy. Let's do this with an example...

Let's say you have a basic calculator and notepad program.
They both do basic things (e.g. - arithmetic and teletyping).
Each program may need ~8MB of RAM, so 16MB of RAM is PLENTY, right?
Well, what if you want to add transparency to your notepad app, so you can see through the background?
What if you want to add a "scientific" mode to your calculator?
What if each of these adds another 8MB of memory for each program, making them ~16MB each?
Then, if you want to use both, only one can exist on your 16MB stick of RAM at any given time.

If you're using the calculator, and want to switch to the notepad, a series of events needs to happen...
1. The page for the calculator needs to be copied out of RAM
2. The page for the calculator needs to be written to the SWAP
3. The page for the notepad needs to be copied out of SWAP
4. The page for the notepad needs to be written to the RAM

And, when you change see the number you want to type into your calculator, and you want to change back...
These read/write cycles are SLOW, and take up a LOT of time that your computer could actually be processing data...
But now, your computer is ALSO processing data as this is all happening...

So, it's not about being smart or stupid... on the contrary, your computer is doing a LOT of smart things under the hood... it's about consumers wanting more features, and developers "stealing" more RAM for themselves, and software changing faster than you can go out and buy new RAM.

And this is why your computer needs so many resources (multiple cores, more RAM, better graphics processing) to do simple tasks... because it's not doing simple tasks like rendering text as OP stated... it's rendering text, it's SWAP-ping memory, it's trying to "predict" what program you'll need next so it can queue that memory up so it's available faster, it's rendering that video you just hacked together, all while it's playing music and video for you to enjoy, and it's sending telemetry back to Micro$hit. There's a lot going on, and developers all got greedy and saw there was "so much room for activities," so they made their apps have ALL the activities, and it uses all of your RAM like its own personal playground instead of sharing it with the other kids.

And we just delved into RAM... what about the multiple cores on your processor, and which app takes priority in queue, and which apps get processed first/last? What about your graphics card... does it devote its cores to rendering your game, or rendering the video you just spliced together, or to your Bitcoin miner, or does it auto-magically split its cores to all of those tasks... and how does it decide what "auto-magically" means, and does that mean the main processor does the math to decide which process gets more/less GPU cores, and how does that "decision" queue up with all of the other things trying to get processed?

Consumers want more, so developers took more, and your software/firmware demands more, so consumers buy more, which makes consumers feel entitled and they demand more, so developers take more...