In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How are swap and zram swap used in Linux systems? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
Disk swap: part of the disk is used as memory, which is completely transparent to the application, which is equivalent to increasing the memory, but the disadvantage is obvious, when using swap, the speed will become very slow.
Zram: part of the physical memory is divided, the memory data that is not commonly used is compressed and put into zram, and when used, the data is decompressed, which is equivalent to sacrificing some cpu efficiency and increasing the memory in disguise.
If the device supports zram, it is definitely preferred to use zram, but some devices have older kernels and can only use disk swap.
Method to check whether the device is zram:
Adb to the shell in the device, under cd / dev/block/, to see if there is zram0 or zram1
If the file is not available, it is not necessarily that the device does not support zram, or it is possible that the kernel does not check the zram option. You can search for zram in the kernel source code.
Here is a script I once wrote: using 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 means no, and 100 represents maximum use.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.