Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was using "system monitor" and noticed that it said "Cache 2 gb"
I understand this is where sets of instructions are stored that are often used a lot by the computer. I would like to know if this 2 GB of cache is on my actual memory modules (ram) in my computer or is it somewhere else - like on the mother board?
See screenshot attached.
Regards,
Michael
Addendum: Perhaps someone could also explain "swap" memory that I see also. I this HD space that is pretending to be memory?
Last edited by Michael Piziak; 04-12-2022 at 03:07 PM.
Purposely deferring your question about "cache," I will now address your second question about "swap."
"Virtual storage" operating systems such as Linux present the illusion to running processes that they own a certain amount of "memory." But they take advantage of a characteristic of running programs known as "locality of reference." That is: "the next memory-reference that will be made by this process is likely to be nearby to its previous one(s)." This enables the OS to use hardware magic to keep within physical memory only those portions of storage that the process is actually right-now using. Anything else can be "swapped out" to external storage, to then be "swapped in" on-demand, possibly "swapping out" something else to make room. The hardware magic arranges things so that the process is never aware. When the process tries to "touch" anything that is not resident in memory, a so-called "page fault" hardware interrupt occurs, which enables the OS to "swap in" the missing information – and the running process is none the wiser.
At this time, the "storage" that has been allocated to running processes exceeds the amount of physical RAM available by about 1.0GB.
Last edited by sundialsvcs; 04-12-2022 at 03:30 PM.
I was using "system monitor" and noticed that it said "Cache 2 gb"
I understand this is where sets of instructions are stored that are often used a lot by the computer. I would like to know if this 2 GB of cache is on my actual memory modules (ram) in my computer or is it somewhere else - like on the mother board?
Yes...memory actually does refer to your memory modules, which would seem obvious. And why, exactly, does it matter where it's located??? If you're that curious, it's odd that you did no research at all into what it is, since that would also explain where it is.
Quote:
Addendum: Perhaps someone could also explain "swap" memory that I see also. I this HD space that is pretending to be memory?
Purposely deferring your question about "cache," I will now address your second question about "swap."
"Virtual storage" operating systems such as Linux present the illusion to running processes that they own a certain amount of "memory." But they take advantage of a characteristic of running programs known as "locality of reference." That is: "the next memory-reference that will be made by this process is likely to be nearby to its previous one(s)." This enables the OS to use hardware magic to keep within physical memory only those portions of storage that the process is actually right-now using. Anything else can be "swapped out" to external storage, to then be "swapped in" on-demand, possibly "swapping out" something else to make room. The hardware magic arranges things so that the process is never aware. When the process tries to "touch" anything that is not resident in memory, a so-called "page fault" hardware interrupt occurs, which enables the OS to "swap in" the missing information – and the running process is none the wiser.
At this time, the "storage" that has been allocated to running processes exceeds the amount of physical RAM available by about 1.0GB.
Thanks.
Will the amount of "swap" memory decrease as one increases the physical memory/ram of the computer?
Also, if swap memory is on the HD, isn't it slower?
Last edited by Michael Piziak; 04-12-2022 at 05:54 PM.
Distribution: Cinnamon Mint 20.1 (Laptop) and 20.2 (Desktop)
Posts: 1,672
Rep:
Quote:
Will the amount of "swap" memory decrease as one increases the physical memory/ram of the computer?
The "swap memory" is actually a swap partition on your hard drive. It's size is usually the same size as the physical memory you have installed as it can also be used when you want to hibernate your system (Put it to sleep) rather than shut it down. The physical memory image is copied to the swap partition to enable the system to restart from where it was put to sleep. The physical volatile memory will be shut down with the rest of the system. When it's woken up, the memory image can be reloaded into physical memory and you can continue with what you were doing.
The swap partition is also used as a location for core dumps when/if your system crashes. (I think)
Quote:
if swap memory is on the HD, isn't it slower?
Yes, if you're running too many memory intensive tasks you will be swapping out and in lots of data and accessing a hard disk is slower than accessing physical memory. (The info can only be accessed each time the data passes under the read head while spinning) More physical memory is always a good thing to prevent what's known as page thrashing - pages of memory being swapped out and in from the HDD. Slows the system and shortens the disks life.
Thanks.
Will the amount of "swap" memory decrease as one increases the physical memory/ram of the computer?
Since you loaded Linux, did you skip the part where you partitioned the disk, and had to allocate space for swap, or at least see it?? How, exactly, would putting more RAM in your computer repartition your disk??
Quote:
Also, if swap memory is on the HD, isn't it slower?
Obviously. But it's rarely used these days, except for certain circumstances. Again, odd that none of your own research into these things turned up much, or that you can't seem to apply things. Odd for a 'scientist'.
I remember, like over 10 years ago, I could control the virtual memory of an old Macintosh - have the HD act like it was physical memory. Was definitely slower.
My desktop has 16 gigs ram and I don't recall it having any "swap" memory show up in "system monitor." I'm away from home and using my Laptop and really just noticed it having like 2 gigs of swap memory in system monitor - the laptop only has 6 gigs Ram.
My desktop, that I increased to 16 gigs, really was an overkill at adding that much memory. I've never seen it try to use over 3 or 4 gigs of ram. The most intensive things I do is probably process photos in Gimp. The laptop, though, having 6 gigs ram, I think it could maybe use a couple more gigs ram.
Basically, every process runs in a "virtual memory" environment, which uses a built-in CPU featured called dynamic address translation (DAT) to present to the process a picture of "what 'memory' looks like" which is blissfully unaware of the existence of any other process – unless it has chosen to "share a memory segment." The addresses generated by the running process are translated to corresponding physical addresses ... or, if the requested information is "not in memory," causes a "page fault" hardware interrupt which passes control to the Linux kernel while the running process is unaware. Linux then "resolves" the problem by bringing in the requested "page" of data, at which time the process can resume and now the data will be there. (A "page fault" will not happen a second time.)
Linux is entirely responsible for doling-out the "physical RAM" resource, and it considers both the physical availability of that resource and the constantly-changing demand for it. Obviously, if you've bought "plenty of physical RAM" ... and you should, because "chips are cheap" now ... Linux will perceive much less need to "swap things out in order to make room to swap things in."
If you'd been a PhD student in the 1970's, you might have been the grad student whose thesis first talked about "Locality of Reference." This is the observation that the next memory reference made by a running process is most-likely to be nearby to one of its recent ones. As long as you design your program to do that – and most "container classes" are already aware of it – your process will run with very little delay caused by "page faults."
If you do not abide by this rule, you can experience the horrors of "thrashing," otherwise known as "hitting the wall." The performance of your process, which up to that point had been degrading linearly, suddenly degrades exponentially, and generally begins to take the rest of the system down with it. "It is not a pretty sight ..."
Last edited by sundialsvcs; 04-13-2022 at 01:04 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.