LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 03-10-2005, 05:14 PM   #1
Skazi
Member
 
Registered: Aug 2004
Location: Minneapolis, MN, USA
Distribution: Slackware 13.1
Posts: 82

Rep: Reputation: 15
vmstat shows swpd as 0


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.

Any ideas?
 
Old 03-10-2005, 09:57 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 03-10-2005, 10:50 PM   #3
Skazi
Member
 
Registered: Aug 2004
Location: Minneapolis, MN, USA
Distribution: Slackware 13.1
Posts: 82

Original Poster
Rep: Reputation: 15
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.
 
Old 03-11-2005, 01:28 AM   #4
Skazi
Member
 
Registered: Aug 2004
Location: Minneapolis, MN, USA
Distribution: Slackware 13.1
Posts: 82

Original Poster
Rep: Reputation: 15
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.
 
Old 03-11-2005, 03:39 AM   #5
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Sar and Vmstat blurblur Linux - Newbie 3 05-03-2005 09:14 PM
vmstat segmentation fault mbeason Debian 0 09-07-2004 05:35 PM
Vmstat and hit rates kiwi_bloke Linux - General 0 08-29-2004 06:44 PM
snmp staus shows it running but on trying MRTG, it shows public@ipaddr not giving res swati220781 Linux - Networking 3 07-08-2004 05:32 PM
desktop shows on TV but movie shows black screen litrelord Mandriva 6 07-05-2004 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration