Linux Format

A quick reference to...

-

you may have wondered why Linux uses so much of your memory and why the memory consumptio­n increases steadily as you use it, until you have very little free.

The reason is that Linux uses memory that would otherwise be sitting idle as disk caches. When you save a file to your hard disk, it’s actually saved to the disk cache and then written to the disk in the background as soon as the system load permits it. You can see this most clearly when writing to a USB flash drive with an LED. After the GUI appears to complete the copy, the LED on the drive may flash for some time as data is actually written to it. This gives you a more responsive system, but also explains why it’s important to shut down properly and unmount all filesystem­s to ensure everything in the caches is flushed to the disks.

Reading benefits similarly, with files held in RAM for faster reading. All of this happens in the background, you don’t need to do anything, but you can see how effective it is with the free command $ free -h

total used buff/cache available Mem: 7.7G 1.6G 245M 5.1G 5.8G Swap: 8.0G 52M 7.9G

Here you can see that 1.6GB of my 8GB RAM is in use by programs, but another 5.1GB is being used for file caches. Clearly, if I had 4GB in this computer, less would be cached and performanc­e could suffer.

The upshot of all of this is that if you want to improve the performanc­e of your computer in the most cost-effective way, adding extra RAM is often the best solution.

free

shared

1.0G

Newspapers in English

Newspapers from Australia