[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Memory-aware Haskell?

Subject: Re: [Haskell-cafe] Memory-aware Haskell?
From: John Van Enk
Date: Thu, 24 Dec 2009 17:46:30 -0500
This is a problem with partitioned operating systems used in avionics. The airplane computers require certain partitions to exist between programs in both time and space. The space guarantees are most easily enforced by eliminating any dynamic memory allocation once the operating system enters a 'normal mode'. This means that all memory needs to be allocated on the stack and ahead of time.

This reduces the calculation of the upper memory bound to checking what the largest possible stack a process could grow to is. Of course, calculating this maximum stack is difficult in its own right.

Unfortunately, nothing I've just discussed seems to port well to Haskell (I could be wrong!). Given this, I think you're looking at a very hard problem (but one I'd be incredibly interested in discovering a solution for!).


On Thu, Dec 24, 2009 at 5:38 PM, Roman Cheplyaka <[email protected]> wrote:
Imagine some system with hard memory bound (e.g. 64M of physical memory,
no swap). I don't want some accidental laziness (maybe even not in my
code, but in some used package) to crash my program.

So, let's think what we can do at runtime. Suppose RTS takes the parameter --
upper limit of consumed memory. When it sees that memory consumption is
close to upper bound, it can:

1. force garbage collection

2. apply some heuristics to find and reduce some chunks which will
  benefit from reduction in terms of size

3. if nothing helps, throw an exeption. It can be caught in IO and
  memory-aware program can make apropriate decision -- e.g. abort
  opening a large file and gracefully warn the user.

(And there still is a problem of foreign code whose memory consumption
we know nothing about...)

What do you think?

Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain
Haskell-Cafe mailing list
[email protected]

Haskell-Cafe mailing list
[email protected]
<Prev in Thread] Current Thread [Next in Thread>