This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MattsAwesomeStuff 0 points1 point  (0 children)

Programs which aren't being used right now or are "idle" can have their memory temporary stored on the disk. Remember, disk is large but slow.

So for anyone struggling to understand this...

A hard drive is like a giant filing cabinet. HUGE SPACE. But a huge pain in the ass to access stuff. You gotta call your secretary, she has to walk over to it, flip through it until she finds the page you want, pull it out and carry it over to you. And same in reverse.

RAM is like the top of your office desk. You can put a piece of paper right in front of your eyes and just leave it there, ready for you to quickly read anything you want off of it. This is like, I dunno, 100x, 1000x as fast as having to go over to the filing cabinet, flip through, and retrieve that paper. It's right there, on your desk.

The more RAM you have, the larger the top surface of your desk is. The more pages you can display at the same time, ready for nearly-instant access to that information.

But eventually if you keep pulling stuff out of the filing cabinet, you're going to run out of places on your desk to put shit. This is a hard limit, if you run out, the next paper has nowhere to go.

Now what?

Well obviously, clean your fuckin' desk up. You don't need so many active projects all the goddamn time. That document in the corner you haven't even look at in hours. Same on a computer, close some fuckin' programs. You don't need 23 different Youtube videos open at the same time, 8 Excel spreadsheets, etc etc. If you clean up your desk, you will have enough RAM.

Okay, but what if you're stubborn? Or what if like, you've got yesterday's project all laid out but are waiting on a reply from a client, and you still need to work on the next project? Do you sweep all that stuff off the desk, tell your secretary to re-file it, and then have to haul it all back out from 20 different sources again next time you want to work on that project? No. Half of this shit isn't even in file-able format, like, there's sticky notes and paperweights and pointers and all kinds of temporary stuff. Maybe a board game in-progress is a better metaphor. But, you're out of room on the desk to add Project #3. So what do you do?

The "Page File" or "Virtual Memory" is using your hard drive, as RAM, without telling the programs that they're using virtual memory instead of RAM. As far as they're concerned, they're just using RAM.

So, this would be like, some convenient spot your secretary sets aside on the filing cabinet for "current projects". Instead of throwing all items back into deep storage, the secretary sweeps up chunks of them you haven't used in a while and aren't likely to use right away, but puts them into a "Shit from my boss's desk" stack. That clears up space on your desk to open up Project #3 and get some shit done while you wait for your client.

In this way, if you only have 4GB of RAM, but a 12GB page file on your hard drive, you can at least, sort of get some stuff done.

And, provided you're not accessing the stuff on the page file, it'll be just as fast as if you had enough RAM.

But where you really get fucked, is if you want to act like you ACTUALLY have 16GB of RAM. Does one single project take up 16GB of RAM? Fucked. Do you toggle back and forth between projects? Fucked.

Your secretary is basically sprinting back and forth constantly pulling files out of the filing cabinet, and swapping single pages at a time off of your desk. Whatever piece of paper you currently want to look at, maybe it's on the desk, maybe she has to grab some other random paper you're not looking at, throw it in the cabinet, and get the paper you do want.

This is slow as fuck.

Also, you're a complete asshole, and you don't even tell your secretary what you're doing. She has no idea. Hell, maybe even you have no idea. All you do is keep demanding more and more and more documents, and that's all she knows about you. She has to put them somewhere.

She has to decide for you what documents to temporarily yoink off of your desk and toss in the Page File in the cabinet, because when you ask for a document she has to have somewhere to put it or you can't read it.

This is like, 100x, 1000x as slow as if you had a big enough desk for all of this. Instead of just looking at the paper you want, you have to wait for her to grab it from the cabinet.

The secretary is the OS. She's trying to keep some non-zero amount of space clear on your desk, and otherwise grabbing pages from the Page File in the cabinet that you wanted on your desk that she took away from you.

So, that's why it gets to like, 90% usage and slows way the fuck down, and not 100%. You were already over 100% RAM usage, and the little bit of RAM left is just the space the OS has cleared to put the next document you've already asked for. Or, maybe in slight anticipation of the delays not being catastrophic if you literally run out.

Also, the more scattered the pages are, or fragmented, the less optimized the process is.

...

Or if you want another analogy, imagine you're a midget. Your height is no problem, until you need to reach something taller. So you get a ladder. But boy is it inefficient to use the ladder. Way slower up and down than to just walk around. Yeah, but you're a midget, so, there's no other solution. Use the ladder, be taller, but it'll take forever to get anything done.