Linux uses part of the hard disk as the swap partition for process scheduling-the process is running.Program-- Change unused processes to 'wait (standby') 'or even 'sleep (sleep)', and then 'Active )', sleep processes lie down in the SWAp partition to sleep, and leave the memory empty for the 'active' process.
If the memory is large enough, It should be told that Linux does not need to use too many swap partitions. You can modify swappiness
. When swappiness is set to 0, the physical memory is used to the maximum extent.
Swap space. When swappiness = 100, swap partitions are actively used, and the data in the memory is promptly moved to the swap space.
In ubuntu, the value of swappiness is set to 60 by default.
!!!! If the memory is small and the process is scheduled frequently, the hard disk will become larger !!!!
Currently, the memory size of 1 GB can be changed to 10, and the memory size of 2 GB can be changed to 5 or even 0. Specifically:
1. View swappiness in your system
$ CAT/proc/sys/Vm/swappiness
If nothing happens, you should see 60.
2. Change the value of swappiness to 10.
$ Sudo sysctl VM. swappiness = 10
However, this is only a temporary modification. After you restart the system, the default value of 60 will be restored. In order to ensure long-term stability, you must proceed further:
$ Sudo gedit/etc/sysctl. conf
Add the following line at the end of this document:
VM. swappiness = 10
Save and restart. OK. Your settings will take effect.
From: http://blog.sina.com.cn/s/blog_60aa9ccd0100h433.html