home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / aix / 9362 < prev    next >
Encoding:
Text File  |  1992-09-03  |  2.9 KB  |  70 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!wupost!darwin.sura.net!uvaarpa!murdoch!sasha.acc.Virginia.EDU!scl
  3. From: scl@sasha.acc.Virginia.EDU (Steve Losen)
  4. Subject: Re: AIX malloc and fault tolerance
  5. Message-ID: <1992Sep3.214527.16681@murdoch.acc.Virginia.EDU>
  6. Sender: usenet@murdoch.acc.Virginia.EDU
  7. Reply-To: scl@sasha.acc.Virginia.EDU (Steve Losen)
  8. Organization: University of Virginia
  9. References:  <1992Sep3.135156.9166@medtron.medtronic.com>
  10. Date: Thu, 3 Sep 1992 21:45:27 GMT
  11. Lines: 57
  12.  
  13. In article <1992Sep3.135156.9166@medtron.medtronic.com>, sh0001@israel
  14. (Scott Hansohn) writes:
  15. |> I have questions:
  16. |>     1) Has anyone seen a system where static memory may not really
  17. be
  18. |>        there, or where a nonzero malloc doesn't guarantee the
  19. successful
  20. |>        usage of the memory?
  21.  
  22. When you malloc a huge chunk of memory, you
  23. do indeed have the memory mapped into your address space.  You just
  24. haven't allocated any pages from swap. If you read this newly
  25. malloc-ed memory (kinda boring since its all zeros) you still don't
  26. allocate any new pages from swap.  You have to actually dirty a page
  27. in order for the system to give you one.
  28.  
  29. About sparse arrays:  Some algorithms require a very large address
  30. space, but actually write to a very small portion of it.  Such
  31. algorithms
  32. run efficiently under AIX because of this design feature.
  33.  
  34. |>     2) Has anyone heard of SIGDANGER before?
  35.  
  36. Only on AIX
  37.  
  38. |>     3) Read the POSIX standard for malloc from a "legal" standpoint.
  39. |>        If IBM claims POSIX compliance, can I use this as a weapon?
  40.  
  41. I have no idea.  Personally, I don't think it's a bad feature.  Just
  42. different.  I can see your point, but I can also see advantages in
  43. AIX as well.  All in all, I think AIX does a nice job with
  44. memory management.  For instance, AIX will make some use of all your
  45. RAM, even when you aren't running enough processes to fill it up.
  46. AIX just uses any spare RAM for cacheing disk data.  SunOS will leave
  47. RAM lying about totally unused if you have more than you need.
  48.  
  49.  
  50. |>     4) Even if I use this malloc wrapper everywhere in my own code,
  51. |>        how do I deal with third-party code I purchase that calls the
  52. |>        unwrapped malloc?
  53.  
  54. You can run lsps -a before running any third-party code to see how much
  55. swap is available.  I admit this is crude.
  56.  
  57. I haven't seen the malloc wrapper, but it sounds like it might be
  58. overly complex.  There is a function called psdanger() that reports
  59. the amount of free swap space.  Instead of writing a signal handler
  60. for SIGDANGER and all that, you could simply see if the system has
  61. enough swap before you malloc.  Admittedly, some other process could
  62. start gobbling pages before you could dirty all of yours, and your
  63. process would get killed in that case.  However, what would you do
  64. if you ever got a SIGDANGER?  Probably exit.
  65.  
  66. --
  67. Steve Losen                     scl@virginia.edu
  68.  
  69. University of Virginia Academic Computing Center
  70.