home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / internal / 1612 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  3.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!news
  2. From: wilson@cs.utexas.edu (Paul Wilson)
  3. Newsgroups: comp.unix.internals
  4. Subject: getrusage() in SunOS: minflt & majflt meaning (reversed?)
  5. Date: 24 Jul 1992 22:05:13 -0500
  6. Organization: CS Dept, University of Texas at Austin
  7. Lines: 58
  8. Message-ID: <l71h79INN8v8@estoril.cs.utexas.edu>
  9. NNTP-Posting-Host: estoril.cs.utexas.edu
  10. Summary: what do ru_minflt & ru_majflt REALLY mean?
  11. Keywords: confused replacement paging faults
  12.  
  13. I'm using getrusage in SunOS on a SPARC ELC and am getting some 
  14. rather weird results.  It appears to me that the meanings of
  15. ru_minflt and ru_majflt are reversed.  Then again I may be
  16. crazy, and I'm sure a couple of other things about my application
  17. aren't what I expect.
  18.  
  19. My guess about minflt and majflt is that they're using a
  20. segmented FIFO queue approximation of LRU replacement, a la
  21. Babaoglu and Ferrari, and that major faults are "real"
  22. page faults that you'd normally think of as page faults,
  23. i.e., you have to go to swap disk to service it.  Minor
  24. faults (supposedly reflected in ru_minflt) are partly
  25. an artifact of the replacement policy, because the system
  26. access-protects your pages behind your back, now and then,
  27. to see if you're still using them.  If you are, it unprotects
  28. them and lets your program continue, without your program
  29. knowing about it.
  30.  
  31. I believe that minor faults also include faults caused by
  32. access protections set at the user level via mprotect(),
  33. and handled with a user-specified handler set by signal().
  34.  
  35. I have two very similar programs, one of which stores data
  36. in a file and faults it in using an access protection hack.
  37. The other leaves very similar data in virtual memory, and
  38. faults it in via the normal virtual memory faulting mechanism.
  39. Before I run either of them, I evict their working sets from
  40. memory and file caches by running a routine that just romps
  41. through a bunch of garbage heap and file data.
  42.  
  43. When the former (file-based) program runs, it should get
  44. ONLY lighweight (user-level) access faults, and possibly
  45. some lightweight faults from the replacement policy.  The
  46. disk activity is not done by the virtual memory system,
  47. but by my access-protection handler which goes through
  48. the file system.
  49.  
  50. When the other program runs, it should get mostly heavyweight
  51. page faults, because it's faulting data in from swap space.
  52.  
  53. The problem is that when I run these programs, I get minflts
  54. and majflts numbers that are the opposite of what I expect.
  55. The program that bypasses the VM and goes through the
  56. file system has lots of majflts and low minflts.
  57.  
  58. Does SunOS 4 have the meanings of those things reversed,
  59. or do I completely misunderstand the those statistics,
  60. or is my program in deep trouble?
  61.  
  62. Thanks prematurely for any assistance,
  63.  
  64.    Paul
  65.  
  66. -- 
  67. | Paul R. Wilson                                    wilson@cs.utexas.edu      |
  68. | U. of Texas Computer Sciences Dept.               voice: (512) 471-9555     |
  69. | Taylor Hall 2.124, Austin, TX 78712-1188          fax:   (512) 471-8885     |
  70. | "Inertia makes the world go 'round."                                        |
  71.