home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!news
- From: wilson@cs.utexas.edu (Paul Wilson)
- Newsgroups: comp.unix.internals
- Subject: getrusage() in SunOS: minflt & majflt meaning (reversed?)
- Date: 24 Jul 1992 22:05:13 -0500
- Organization: CS Dept, University of Texas at Austin
- Lines: 58
- Message-ID: <l71h79INN8v8@estoril.cs.utexas.edu>
- NNTP-Posting-Host: estoril.cs.utexas.edu
- Summary: what do ru_minflt & ru_majflt REALLY mean?
- Keywords: confused replacement paging faults
-
- I'm using getrusage in SunOS on a SPARC ELC and am getting some
- rather weird results. It appears to me that the meanings of
- ru_minflt and ru_majflt are reversed. Then again I may be
- crazy, and I'm sure a couple of other things about my application
- aren't what I expect.
-
- My guess about minflt and majflt is that they're using a
- segmented FIFO queue approximation of LRU replacement, a la
- Babaoglu and Ferrari, and that major faults are "real"
- page faults that you'd normally think of as page faults,
- i.e., you have to go to swap disk to service it. Minor
- faults (supposedly reflected in ru_minflt) are partly
- an artifact of the replacement policy, because the system
- access-protects your pages behind your back, now and then,
- to see if you're still using them. If you are, it unprotects
- them and lets your program continue, without your program
- knowing about it.
-
- I believe that minor faults also include faults caused by
- access protections set at the user level via mprotect(),
- and handled with a user-specified handler set by signal().
-
- I have two very similar programs, one of which stores data
- in a file and faults it in using an access protection hack.
- The other leaves very similar data in virtual memory, and
- faults it in via the normal virtual memory faulting mechanism.
- Before I run either of them, I evict their working sets from
- memory and file caches by running a routine that just romps
- through a bunch of garbage heap and file data.
-
- When the former (file-based) program runs, it should get
- ONLY lighweight (user-level) access faults, and possibly
- some lightweight faults from the replacement policy. The
- disk activity is not done by the virtual memory system,
- but by my access-protection handler which goes through
- the file system.
-
- When the other program runs, it should get mostly heavyweight
- page faults, because it's faulting data in from swap space.
-
- The problem is that when I run these programs, I get minflts
- and majflts numbers that are the opposite of what I expect.
- The program that bypasses the VM and goes through the
- file system has lots of majflts and low minflts.
-
- Does SunOS 4 have the meanings of those things reversed,
- or do I completely misunderstand the those statistics,
- or is my program in deep trouble?
-
- Thanks prematurely for any assistance,
-
- Paul
-
- --
- | Paul R. Wilson wilson@cs.utexas.edu |
- | U. of Texas Computer Sciences Dept. voice: (512) 471-9555 |
- | Taylor Hall 2.124, Austin, TX 78712-1188 fax: (512) 471-8885 |
- | "Inertia makes the world go 'round." |
-