Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, on my mostly idle system, vmstat is showing swpd as 0:
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 30676 55344 36520 0 0 6 1 101 8 0 0 100 0
Accoding to the vmstat man page, swpd is "the amount of virtual memory used".
I don't understand why that would be 0.
I googled it, and saw the question asked a few times, but never answered.
Maybe your system just hasn't swapped. My laptop has been up for about 5 days and vmstat shows 0 for me too, and free shows no swap space in use. So it's possible for Linux to not swap anything at all, I suppose.
So, in Linux does "virtual memory" mean swap space?
In Windows, virtual memory includes the total memory allocated to a process, including the space resident in RAM and the space swapped out to the page file.
Indeed, swpd in vmstat seems to indicate swap space. I wrote a small program that allocates more memory than i have physical RAM, and swpd went up.
In top, the VIRT column gives "The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out." So, VIRT seems equivalent to the process - Virutal Bytes counter in Window's perfmon.
Note that a swap usage rate of zero is highly desirable because it means that your existing RAM can handle the load that's being put on it without resorting to writing memory pages to disk. In other words, anytime your system has to access swap, you will be taking a *huge* performance hit -- access times in RAM are measured in nanoseconds; access times on hard drives are measured in milliseconds. That's about 6 orders of magnitude worse, and you should avoid it if at all possible.
To say it another way, Linux treats swap space as a resource of last resort. If the demands you are putting on your machine are such that RAM is overloaded and cannot handle it, then your system will write out memory pages to disk, but as mentioned this is only done when RAM is entirely overloaded. Back in the days were 64Mg was considered leading edge, it was pretty common for swap to be called into service, but these days, where 256Mg if not 512Mg of RAM is standard, it's increasingly infrequent that swap gets used.
Overall, I'd consider zero swap usage to be a compliment to how you've set up your system. That being said, reserving some swap space (256Mg max, regardless of the RAM) is a useful thing, just in case. -- J.W.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.