What is SWAP Partition and Functions in Linux

Understanding, Functions and How SWAP Partitions Work on Linux Operating Systems.

When installing the Linux operating system, other than the partition “/” as a file system partition that must exist, you are also advised to create a partition called SWAP.

SWAP partition may sound foreign to Windows operating system users, but not to Linux operating system users. Everyone who uses or has ever used a Linux operating system knows the SWAP partition.

Then, what exactly is a SWAP partition? What is its function? What if you don’t use a SWAP partition on Linux?

Virtual / Backup Memory

In simple terms, a SWAP partition is an empty space or partition of a storage media that functions as a file memory virtual or memory backup for main memory, namely RAM (random access memory).

When we run an application on a computer, RAM will act as a temporary storage medium for the data of the application or process that is being worked on. This means that the more applications or processes that are carried out, the more data that must be accommodated in RAM.

While a RAM also has its own capacity or size of capacity. Then what if there are too many processes or applications running and it exceeds the RAM capacity on the computer?

This is where the function of a SWAP partition on Linux. When processes in RAM have exceeded RAM capacity, some of these processes will be redirected and run on SWAP.

With this statement, it might make us (some) think that we don’t really need a large RAM, we don’t need to buy a large RAM, just use a small RAM size and create a large SWAP partition.

However, this assumption is wrong. RAM is hardware which has a very high speed, while the Harddisk — the hardware where the SWAP partition exists — is a hardware device that has slow performance.

The data or processes that are moved from RAM to the SWAP partition are data that are not important and are not used often, so it doesn’t matter if they have to be moved to SWAP, with the fact that the SWAP partition from the hard disk has slow performance.

Swappiness

The determination of which of the many processes can be moved from RAM to SWAP depends on: swappiness. Processes that have higher swappiness will be more likely to be moved to SWAP, whereas processes that have swappiness lower ones are unlikely to be transferred to SWAP.

By moving these unimportant and rarely used processes to SWAP, RAM will have more free space, so RAM can be used by more important processes or jobs. And the computer will have better performance.

Hibernate

In addition, SWAP also serves as a destination for moving the contents of RAM when a Linux computer performs an operation hibernate.

Hibernate is a feature to turn off the computer temporarily without having to exit or close the work you are doing. On the Linux operating system, the work you are doing will be stored on the SWAP partition, so that when you restart your computer, your computer will be in the same state as when you shut down or did something. hibernate your computer

Without using SWAP partition, Linux you can’t do hibernate.

So, does a device using the Linux operating system actually have to have a SWAP partition? No, you don’t have to have a SWAP partition.

But by having a SWAP partition, you have memory backup, you can also move tasks that are not important or rarely used to SWAP so that RAM can work better, and allows you to do hibernate.

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *