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