Swap and zram under Linux are two techniques for expanding memory, which can indicate the performance of the system to a certain extent. Of course, swap and zram swap, in general, the use of zram is more. Here's how to use the Linux system swap and zram swap?
Disk swap: is the part of the disk as memory, the application is completely transparent, comparable to the increased memory, but the disadvantage is obvious, when used in the swap, speed It is very slow.
zram: It is to divide a part of the physical memory, compress the memory data that is not commonly used, and put it into zram. When it is used, the data is decompressed, which is equivalent to sacrificing some CPU efficiency and increasing disguised. The memory.
If the device supports zram, it is definitely preferred to use zram, but some device kernels are older, only use disk swap.
To see if the device is zram:
adb to the shell in the device, cd /dev/block/, see if there is zram0 or zram1
If there is no such file It is not necessarily that the device does not support zram. It is also possible that the zram option is not checked in the kernel. You can search for zram in the kernel source.
The following is a script that was written: use disk swap
#! /system/bin/sh
#SWAP_FILE=“/data/swap1”
if [ ! -f “/data/swap1” ]; then
dd if=/dev/zero of=/data/swap1 bs=390250 count=256
fi
Busybox mkswap /data/swap1
busybox swapon -p 0 /data/swap1
echo 0 》/proc/sys/vm/swappiness
cat /proc/sys/Vm/swappiness
busybox free -m
The value in /proc/sys/vm/swappiness represents the priority of using swap, 0 is not used, 100 means maximum use
Update:
If you want to know which swap file the current swap uses,
cat /proc/swap will know.
The above is the use of the Linux system swap and zram swap. If your computer's memory is too small, you can use swap or zram swap to expand the memory.
When we are doing Linux system operation, sometimes there will be a network disconn
A lot of people want to know how to close a website on a Linux server because the website is on the
Linux system use setitimer function can be high-precision timing function, used to execute functions
mysql is a relational database management system, but recently users have reported that it is imposs
How Linux Expands Disks under VMware
What should I do if the error occurs when CentOS 5.4 adds or removes an application?
Steps to install Tmux software on CentOS
Linux method for copying files/folders using CP commands
Learn about the role of Linux mail commands through examples
Linux installation steps using GitHub
Modify Linux password prompt it is based on a dictionary word What to do?
How to install Eclipse and PyDev extensions in Ubuntu 14.04?
Steps to install Fluentd on RedHat
Win10wp version of Starbucks when
Win7 automatically switches background image method
Windows 7 firewall can not be enabled to solve
Win7 computer desktop icon how to restore how to restore? Win7 desktop icon how to become smaller?
How to modify the color of windows7 translucent window
Win10 system all the built-in applications can not open how to solve?
Backup and restore functions of Windows 7
Looking at the improvement of Windows7 through the Chinese version (6)