home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sgi / 12655 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.9 KB

  1. Path: sparky!uunet!usc!news!benton.prepress.com!bob
  2. From: bob@prepress.com (Robert Crowe)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: Not enough swap space
  5. Message-ID: <1992Aug20.063826.20085@prepress.com>
  6. Date: 20 Aug 92 06:38:26 GMT
  7. References: <7085@charon.cwi.nl> <oplo2uo@fido.asd.sgi.com>
  8. Organization: Pre-Press Technologies, Carlsbad Ca.
  9. Lines: 67
  10.  
  11. In article <oplo2uo@fido.asd.sgi.com> williams@agomoda.asd.sgi.com (Eric Williams) writes:
  12. >In <7085@charon.cwi.nl> robertl@cwi.nl (Robert van Liere) writes:
  13. >
  14. >
  15. >>A long, long time ago (i.e. in the 3.3.? days) Lance M Option @ NIH
  16. >>wrote :
  17. >>
  18. >>>     SGI System Gurus:
  19. >>>       We are experiencing problems with "malloc()".  It seems
  20. >>>       that if an amount of memory greater than the sum of
  21. >>>       free memory and free swap space is requested, the malloc()
  22. >>>       succeeds, but the program is killed by the OS when the
  23. >>>       memory is used.  How can this condition be caught?  Can't
  24. >>>       the OS give some indication to the user of why his proc died?
  25. >>
  26. >>We are currently experiencing this behavior as well. Can this condition
  27. >>be caught in 4.0.5 ? If not, is there something else we can do to avoid
  28. >>these (SysV related) "problems".
  29. >
  30. >I think the following should help.  It ought to change the behavior so that
  31. >the malloc will fail.  The default as shipped is to have behavior as you
  32. >describe.  (This change might also mean that processes are limited to total
  33. >swap space, rather than the sum of swap space and physical memory.  Sorry
  34. >I don't know for sure, so I can't say).
  35. >
  36. >Edit /usr/sysgen/master.d/kernel:
  37. >
  38. >/*
  39. > * preallocation of swap space
  40. > *      0  ==> disk space not preallocated for processes;
  41. > *      !0 ==> disk space preallocated on fork/exec/sbrk/etc.
  42. > */
  43. >int availsmem_accounting = 0;
  44. >
  45. >
  46. >Change the 0 to 1.  Run /etc/autoconfig.  Reboot.
  47. >
  48. >-Eric Williams
  49.  
  50. Note that this means when your 16 MB process does a system("ls"), or something
  51. similar, unless you have another 16 MB to run ls in, the fork will fail.
  52. At least thats how I understand it.  I don't like it much myself - I don't 
  53. understand what was so bad about vfork (then again I'm not that familiar with
  54. the internals of the operating system).  The way it is now, you either never
  55. fork from a large program (but have a safe malloc), or you fork all you want, 
  56. but roll the dice when you call malloc ( actually some point after that ).
  57.  
  58. One nice thing about the default method is that you can change all of these:
  59.  
  60.     if (!ch = malloc(size))
  61.     return err;
  62.         
  63. To these:
  64.  
  65.     ch = malloc(size);
  66.  
  67. Malloc simply will NOT fail for lack of memory.  How many existing unix 
  68. programs will break under this arrangement do you think?
  69.  
  70.  
  71. My 2 cents.
  72.  
  73. -- 
  74. ============================================================
  75. Bob Crowe                      Voice:   (619) 931-2695
  76. Pre-Press Technologies.        Email:    bob@prepress.com
  77. 2443 Impala dr.               FAX:     (619) 931-2698
  78.