Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: The massive memory myth  (gelezen 339 keer)

Offline VuurVosje

  • Lid
  • Steunpunt: Nee
The massive memory myth
« Gepost op: 2016/08/01, 09:49:33 »

The massive memory myth

One common complaint new Linux users tend to have is that Linux uses a lot more of their computer's memory than other operating systems. Newcomers tend to ask why Linux requires more RAM than their previous operating system and why memory usage balloons so quickly after they sign into their desktop session. Linux has a reputation of working on older computers and this leads people to wonder how that can be true when a massive amount of their RAM is being used.

What new Linux users are experiencing is usually not a difference in how their computer's RAM is being used, but how that usage is being reported to them. Most modern operating systems use memory in similar ways, but Windows, Linux and the BSDs will report on how memory is being used quite differently.

When we open a document or launch an application that data is loaded from our computer's disk into memory. While the application or file is open, the data is considered to be in active use. When we close the document or application, the operating system will usually keep the data in memory for quick access later. Reading information stored in RAM is a lot faster than re-loading the same information from the hard disk, and so it makes our computer faster if information is kept in RAM. Information that is still in RAM, but not being actively used, is considered to be cached or inactive data.

Cached data will usually be stored in RAM until the operating system needs to use that space for something else, like a new image or document we are trying to open. At that point, the cached data is over-written by the new file we are accessing. This new data will also stick around in RAM until the space is needed by yet another program or document.

Modern operating systems view any unused RAM as being a wasted resource. Ideally, as much information should be copied into RAM as possible for quick access. The cached data is not preventing us from loading new information into memory as the cached information will simply be replaced as needed.

While most operating systems work this way, different operating systems report their memory usage differently. Linux, for example, will usually report how much RAM is being used in total, combining both the actively used memory and cache. When we run a process monitor such as top we usually see the combined active and cached memory statistics. This makes Linux's memory usage look unusually high. Some tools, like the free command, will show both combined memory usage and break down active and cached data into separate statistics.

The BSDs feature utilities which generally break memory usage down further. When running the top command on FreeBSD, for example, we see actively used memory, inactive memory, cached memory, "wired" memory which is usually data reserved by the kernel and drivers, and free memory which is not being used for anything.

Memory monitoring tools on other operating systems may simplify things a bit by focusing on the amount of memory actively in use, which is relatively small. This makes sense as actively used memory is usually the statistic we see as being the most important. But in focusing on active memory, memory which is being used and cannot be overwritten, we gloss over the other data being held in RAM for future use. Linux does not hide cached data in its statistics, making the operating system appear more memory hungry than it really is.

In short, we need to focus more on actively used memory and remember to ignored cached data as the cache is not being actively used and may be overwritten as needed. Having a lot of cached data in RAM is a good thing as it allows files and applications to be loaded more quickly.

* * * * *
Additional Myth and Misunderstandings articles can be found in our archive.


En ook niet klagen over RAM-gebruik als je de swap-neiging erg laag hebt gezet...  ;)

Offline bwman

  • Lid
  • Steunpunt: Nee
Re: The massive memory myth
« Reactie #1 Gepost op: 2016/08/05, 14:43:06 »
intressant artikel weer wat bijgeleerd thx voor het delen
firefighter is not something you do..........
                                         its something you are
nexus 5,  huawei P9 lite, Nokia 7 plus , mint cinamon,
Saab enthousiast