home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / aix / 9622 < prev    next >
Encoding:
Internet Message Format  |  1992-09-13  |  5.6 KB

  1. Path: sparky!uunet!know!hri.com!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!usc!wupost!darwin.sura.net!jvnc.net!rutgers!modus!gear!cadlab!martelli
  2. From: martelli@cadlab.sublink.org (Alex Martelli)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: AIX malloc and fault tolerance
  5. Message-ID: <1992Sep11.101004.1401@cadlab.sublink.org>
  6. Date: 11 Sep 92 10:10:04 GMT
  7. References: <1992Sep3.135156.9166@medtron.medtronic.com> <1258@curly.appmag.com>
  8. Organization: CAD.LAB S.p.A., Bologna, Italia
  9. Lines: 94
  10.  
  11. pa@curly.appmag.com (Pierre Asselin) writes:
  12.  
  13. :In <1992Sep3.135156.9166@medtron.medtronic.com>
  14. :    sh0001@israel (Scott Hansohn) writes:
  15. :
  16. :[He bumped into the malloc virtual allocation nonsense again.
  17. : I still get mad just thinking about it.]
  18.  
  19. DITTO!  And the excuses we get about it look just like that, EXCUSES!
  20.  
  21. :Some arguments to the effect that vapour-memory was a good thing were:
  22. : -Lets you use gigantic sparse arrays.
  23. : -Lets vendors ship Fortran binaries with static arrays dimensioned
  24. :  to maximum size, and yet have them run on small machines for small
  25. :  problems that use only part of the arrays.
  26. :
  27. :I'm skeptical.  Sparse arrays at 4kB/page?  As for the Fortran bit, it
  28. :only makes sense on machines dedicated to a single application.  That
  29. :sure isn't the way we use ours.
  30.  
  31. Dedicating a WS to a single (set of) application IS the typical way that
  32. cad.lab customers would use their machines, and we are heavy Fortran
  33. users, and the malloc()-but-not-really idea STILL stinks.  We are
  34. selling INDUSTRIAL STRENGTHS applications, that will be used for CRUCIAL
  35. PRODUCTION WORK; it's COMPLETELY UNACCEPTABLE for our customers to lose
  36. data because the application dumps abruptly!!!  So our apps are full of
  37. error-checks.
  38.  
  39. In particular, we do NOT place data, that will grow for large problems,
  40. inside Fortran arrays; they reside, instead, in areas which are
  41. dynamically allocated by an underlying library written in C, and
  42. accessed via functions or subroutines by the Fortran portions.  On
  43. machines where malloc() semantics make sense, the C routine will return
  44. an error indicator to the Fortran portion if it's unable to get the
  45. memory requested; in this case, the application communicates to the
  46. interactive user that the requested operation cannot be completed due to
  47. running out of virtual memory, but the app is still alive and the user
  48. can save hir work so far, and restart from there presumably after having
  49. swapspace reconfigured.
  50.  
  51. We've been particularly careful that nothing in the save-to-disk
  52. subsystem NEEDS to allocate extra memory, so that the saving will work
  53. even in crucial memory-low situations; we even had to recode the
  54. output-to-file portions as C subroutines running over low-level
  55. systemcalls, as we found with surprise that Fortran I/O, and C stdio, on
  56. some platforms, may need a malloc() to succeed and will die if it fails
  57. (and, yes, our applications ARE and WILL REMAIN extremely portable
  58. code).
  59.  
  60. All this care, of course, is for naught on the IBM R/6000 (thankfully we
  61. don't presently run on DG Aviion, where malloc() reportedly's similarly
  62. broken).  And no, we can't just set "limit datasize" appropriately,
  63. because it depends on what the user is doing exactly: sometimes the 3D
  64. modeler will be running alone, other times it will be scheduled together
  65. with the 2D drafter and/or the surface renderer and/or the relational
  66. database and/or the tool which builds programs for numerically
  67. controlled tools and/or...  each of these applications is written to be
  68. able to run alone OR communicate with its brethren.
  69.  
  70. We've tried the tricks IBM suggested to stop our application from dying
  71. in unexpected places, but what happens then is that OTHER processes
  72. die -- and the first to go is typically the X server (a memory hog, I
  73. guess!), so the user cannot communicate with the apps to ask to save...
  74. and NO, we CANNOT just do the saving from the SIGDANGER handler as a
  75. safetynet; the handler can be basically entered from anywhere in the
  76. application, including "critical sections" where the data structures
  77. are in transition and inconsistent (and NO, we CANNOT protect the
  78. critical sections by turning off signals there, or we'll die for
  79. lack of SIGDANGER handling).  
  80.  
  81. Yes, I know that a thousand clever tricks spring to mind to workaround
  82. one of the other of these problems, but believe me:  we must have tried
  83. at least 900 of them and they don't work.  We've spent more time and
  84. effort on battling this malloc() idiocy than on any other single porting
  85. problem EVER (and with the huge list of platforms we've supported over
  86. the years we've had quite SOME such problems, believe you me!)!!!  Most
  87. porting problems come from bugs in the target system, some from bugs in
  88. our code, but here we're fighting against something BROKEN AS DESIGNED
  89. -- ***HORRIBLY*** BROKEN.  I would say it's been half the cost of the
  90. IBM R/6000 port, if it weren't for the fact that the monstruously slow
  91. linker (thankfully remedied in 3.2, but this port was started right at
  92. system announcement...)  and the bugs in the early X have driven that
  93. cost way up.  Anyway, at the end, we've given up and just document to
  94. our customers how AND WHY their work may go up in smoke on IBM R/6000
  95. and not on DEC, Olivetti, Sun, HP, Sony or other platforms.
  96.  
  97. If IBM ever gives us a malloc() WHICH WORKS, we'll be glad to use it.
  98. And I hope that periodically rekindled flames about it will do some
  99. good -- if we could get together with everybody who's suffered for
  100. this and blackmail IBM into it the world would become a better place
  101. in at least this small way...
  102. -- 
  103. Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
  104. CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 
  105.