Home > Information technology essays > Linux Mint memory management

Essay: Linux Mint memory management

Essay details and download:

  • Subject area(s): Information technology essays
  • Reading time: 3 minutes
  • Price: Free download
  • Published: 15 September 2019*
  • Last Modified: 22 July 2024
  • File format: Text
  • Words: 806 (approx)
  • Number of pages: 4 (approx)

Text preview of this essay:

This page of the essay has 806 words.

While not a unique feature to Linux Mint this operating system stores nearly everything it can in RAM such as kernel data, user application data, and mirroring data stored on the disk for faster access. The reason it does this is, to most linux systems empty RAM is wasted RAM. From the user level this can be seen as “buffers/cache”, “disk cache” or “cached”. Cached memory is used because of how quickly it can be replaced if a process needs it letting it be essentially free. Leaving everything in the cache means that if a certain piece of data needs to be called again there is a high likelihood that it will still be cached in memory.
Often times the Linux Page Cache is one of the largest consumers of RAM on the system, this is because whenever read() is used for a file on disk the data is stored in the page cache. Once the read() is complete the kernel can decide to throw the page away since it is not being used anymore. The kernel may not decide to the the page out however because if a second read is required from the same area of the file it can read the data directly from memory thus being able to skip the disk altogether leading to a rather large speedup.
There are three main fields that the user needs to be aware of when it comes to understanding memory management. The first such field is VIRT or virtual size of a process. This displays the sum total of memory the process is using, and memory it has mapped into itself, files on disk that have been mapped into it (e.g. shared libraries), and memory that is shared with other processes. Additionally VIRT represents how much memory the process can access at any given moment.  The second field is RES or resident size, this is an accurate representation of how much physical memory a process is consuming. Most of the time RES will be smaller than VIRT. The third and final field is SHR or shared memory size. SHR shows how much of VIRT is shareable between processes. If a program implements some but not all functions from a library the entire library is mapped and will show in both VIRT and SHR however only the parts of the library that contain the functions being used are counted when calculating RES.
As stated earlier Mint’s kernel tries to store as much as it can in RAM, this leads to the obvious problem of what will the system do when it runs out of open space in RAM. When the system is “out” of RAM (the system will attempt to not let the system reach 0 bytes of free RAM because it needs a chunk of RAM to continue to run and allocate more space) it resorts to swapping. When the kernel starts to swap it takes the user application data and writes it to special protected portions on the disk. The system usually has many locations in memory that are loaded with user application data that is not used often, it is these locations that are often the target of being swapped in favor of better applications of RAM.  The kernel implements a Swap Cache, the swap cache is a very similar concept to the Page Cache, meaning that a page of user application data being written to the disk is very similar to how file data is written on the disk. Whenever a page is read into swap it is placed into the Swap Cache. The Swap Cache has one major drawback, that is that it is only of use when we only read from it and never write to it, this is because once we write to it the copy on the disk is no longer in sync with the copy that is stored in memory. When this happens the kernel has to write to the disk to swap out the page.  When an application requires memory and the RAM is at capacity the kernel can deal with the problem in two ways it can reduce the disk cache in the RAM by removing the oldest data or it can swap less used portions of programs out of the swap partition. It is not a cut and dry process on what method will be more efficient. The kernel makes the decision by weighing the effectiveness of the two methods at any given instant against the recent history of the activities. The user has a way to intervene in how the kernel handles this process it is called swappiness. Swappiness is given a value from 0 to 100 to affect the outcome of swapping and freeing cache. At 100 the kernel will always prefer to swap whereas at 0 it will just remove the old processes.

About this essay:

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay Sauce, Linux Mint memory management. Available from:<https://www.essaysauce.com/information-technology-essays/2016-11-15-1479172489/> [Accessed 15-04-26].

These Information technology essays have been submitted to us by students in order to help you with your studies.

* This essay may have been previously published on EssaySauce.com and/or Essay.uk.com at an earlier date than indicated.