home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / sgi / 19077 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.8 KB

  1. Path: sparky!uunet!olivea!sgigate!sgi!quasar.mti.sgi.com!davea
  2. From: davea@quasar.mti.sgi.com (David B.Anderson)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: strange compiler behavior
  5. Message-ID: <v8hosok@sgi.sgi.com>
  6. Date: 23 Jan 93 22:33:28 GMT
  7. Sender: davea@quasar.mti.sgi.com
  8. Organization: Silicon Graphics, Inc.  Mountain View, CA
  9. Lines: 35
  10.  
  11. In article <1993Jan23.043404.20003@Princeton.EDU> igor@fine.Princeton.EDU (Igor Rivin) writes:
  12. >
  13. >Why is it that if you declare an uninitialized global array,
  14. >three times as much virtual space as necessary gets allocated?
  15.  
  16. Well it should really be twice as much plus alignment (which can, in unusual
  17. cases lead to 3X, I admit).
  18.  
  19. I call this the 'bss bloat' (and it's my fault...). This is ONLY in
  20. .bss, not in other sections.
  21.  
  22. The linker is rounding things in bss to page boundaries.  It knows that
  23. at least 2 things there are used as file buffers.  By guaranteeing that
  24. these are on page boundaries the kernel can page-flip the data into
  25. your running program rather than copying byte-by-byte.
  26.  
  27. In your release it is rounding everything in bss (individually)
  28. rather than being selective.
  29.  
  30. Since it cannot really know all that is in bss, it is forced to
  31. *duplicate* all the stuff of interest.    The extra VM is never
  32. referenced so is never allocated in swap (depending on
  33. availsmem_accounting in a file in /usr/sysgen/master.d, of course)
  34.  
  35. **In the 3.10-IDO linker for 4.0.5 ONLY two things are aligned so
  36. the bss bloat (all but a little of it) goes away.**
  37.  
  38. You can turn this off completely with -Xnobsschange (see the ld man page).
  39.  
  40. In your own programs doing open(2)/read(2)/write(2), do i/o in page
  41. multiples from page-aligned addresses on disk into page-aligned memory
  42. and you will, normally, get faster i/o!
  43.  
  44. Hope this makes some sense.
  45. [ David B. Anderson             (415)390-4263             davea@sgi.com ]
  46.