LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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



Reply
 
Search this Thread
Old 11-07-2012, 11:48 AM   #1
yash0307
LQ Newbie
 
Registered: Jan 2012
Posts: 10

Rep: Reputation: Disabled
linux print virtual pages associated with processes


how can I print the virtual pages allocated to the currently running processes on my system and also the page faults associated with them?
 
Old 11-07-2012, 12:01 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
Please elaborate little more, what exactly your requirement is & what you've tried so far...
 
Old 11-07-2012, 12:06 PM   #3
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by yash0307 View Post
how can I print the virtual pages allocated to the currently running processes on my system and also the page faults associated with them?
I don't know about associating page faults to pages or to processes. But the virtual pages of each process are available from
/proc/pid/smaps
where you replace pid with the pid of each task you want info on.
 
1 members found this post helpful.
Old 11-07-2012, 12:14 PM   #4
yash0307
LQ Newbie
 
Registered: Jan 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
Please elaborate little more, what exactly your requirement is & what you've tried so far...
I want to list out all the processes that are currently running on my system, and print the virtual pages allocated to it and number of page faults associated with each process.

I have tried it out with many commands to get the solution like vmmstat,top and ps (ps aux)..but didn't succeed.
please help me out.
 
Old 11-07-2012, 12:45 PM   #5
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by yash0307 View Post
the virtual pages allocated to it
I'm still not sure whether you mean the total number of virtual pages or something much more detailed, all the way up to some kind of identification of each virtual page.

Either way, there are some complicated questions about what "allocated" means.

The smaps info gives you quite a lot of detail (but not all the way down to individual pages) about what is mapped in the virtual address space of a process. One conceivable meaning of "allocated" in your question might be everything that is mapped. The total size of all the mappings is the VIRT column in top and similar tools.

But that is a larger value than what you are likely to think "allocated" means. Mappings may be "demand zero" so the pages don't take up space anywhere (neither on disk nor in ram). Mappings may be "copy on write" so the same physical pages (on disk or in ram) are counted by more than one process even though not shareable. Of course, pages may be shareable and those might or might not actually be shared, so pages may be counted by more than one process without being "copy on write".
 
1 members found this post helpful.
Old 11-07-2012, 12:52 PM   #6
yash0307
LQ Newbie
 
Registered: Jan 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
Wink

Quote:
Originally Posted by johnsfine View Post
I'm still not sure whether you mean the total number of virtual pages or something much more detailed, all the way up to some kind of identification of each virtual page.

Either way, there are some complicated questions about what "allocated" means.

The smaps info gives you quite a lot of detail (but not all the way down to individual pages) about what is mapped in the virtual address space of a process. One conceivable meaning of "allocated" in your question might be everything that is mapped. The total size of all the mappings is the VIRT column in top and similar tools.

But that is a larger value than what you are likely to think "allocated" means. Mappings may be "demand zero" so the pages don't take up space anywhere (neither on disk nor in ram). Mappings may be "copy on write" so the same physical pages (on disk or in ram) are counted by more than one process even though not shareable. Of course, pages may be shareable and those might or might not actually be shared, so pages may be counted by more than one process without being "copy on write".
I think you previous answer is what I want for this question-->"all the virtual pages of each process" and the number of page faults I can find out through the ps command using the pid of the process.I think my problem is solved.

thanks a lot
 
Old 11-07-2012, 12:54 PM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
Inside the /proc directory, you'll find associated directories for every process, named same as pid. So you can try searching required info. in "status" file inside every pid dir. i.e. in /proc/<pid>/status file.
 
  


Reply

Tags
linux, memory management


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Openwriter : how to print 2 pages on the same A4 ? tulear Mandriva 2 08-13-2005 11:33 AM
How to print Man Pages anindyanuri Linux - Software 8 05-13-2005 10:38 PM
How to print man pages? fclifton Linux - Newbie 3 09-25-2004 07:33 PM


All times are GMT -5. The time now is 06:31 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration