Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I'm currently trying to locate which processes are in the swap space and how much memory that processes is using. Could someone help me tell the correct program to locate this...
applications per say aren't in or out of swap space the way it might be in some very old legacy operating systems. swap is used only to store non media backed anonymouse data and the data that is swapped out is in relation to it not being accessed in a while. virtual page mapping as far as i know is non contiguous but you might be able to figure out what is in swap by looking in the /proc filesystem
if you understand memory addresses ? I know i can't figure it out.
You won't be able to tell from the memory address. When a page is swapped out all the will happen is that that page will be marked as invalid in the process' page table (and there's some other accounting records to show how to find it in swap). One thing to do is run top, and then press the "f" key to choose what fields are shown. Modern versions of top will have the ability to display the amount of the process that's currently swapped (pressing P in the field selection in my version of top).
Originally posted by btmiller . One thing to do is run top, and then press the "f" key to choose what fields are shown. Modern versions of top will have the ability to display the amount of the process that's currently swapped (pressing P in the field selection in my version of top).
fascinating
i think this means it is actually spelled out in /proc somewhere -- all top does is parse /proc
possibly /proc/<PID>/statm or something
would have to make machine use swap to check it out -- a task for another day
Originally posted by foo_bar_foo
OK i tried this and the SWAP output from top is crap
it's just SWAP = VIRT - RES
that tells us exactly nothing
Huh ????
That would be precisely my definition. Could probably be (more logically) expressed as "VIRT = RES + SWAP".
What have dirty pages got to do with the swap discussion - if they are dirty they are "pinned" in physical memory, and so are included in the resident count.
If they are anonymous, and have been swapped out, they are in the SWAP count - and increase the VIRT size accordingly.
I haven't looked specifically at the code for this, but seems logical to me.
Originally posted by syg00 Huh ????
That would be precisely my definition. Could probably be (more logically) expressed as "VIRT = RES + SWAP".
What have dirty pages got to do with the swap discussion - if they are dirty they are "pinned" in physical memory, and so are included in the resident count.
If they are anonymous, and have been swapped out, they are in the SWAP count - and increase the VIRT size accordingly.
I haven't looked specifically at the code for this, but seems logical to me.
so 0 swap used and still 2/3 of my physical RAM unused
so lets look at what you said for startx
Code:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND
1006 gary 17 0 4684 1320 4224 S 0.0 0.1 0:00.00 3364 startx
3364 SWAP used by startx
with 0 swap actually used and lots of physical RAM free
it seems rather obvious that all the virtual memory is not in either swap or resident
but is "virtual" duhhhh.
and clean anonymous pages under memory pressure just get ejected not written to swap because they contain nothing at all so dirty has something to do with it.
Last edited by foo_bar_foo; 11-05-2005 at 09:04 PM.
O.K. I'll shut up and go back and hide under my rock ...
I've always been happy to accept VIRT = RSS + SWAP.
Maybe that's just a convenient shorthand for "VIRT = RSS + all the other bits" ...
Those numbers do need some explaining that is beyond me. May just be an issue with the way "top" calculates and/or presents the numbers, although meandering through /proc/<pid>/status also shows some (lesser) annomalies.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.