Overcommittable memory (Was: Some questions about linux kernel.)

From: Rask Ingemann Lambertsen (rask-linux@kampsax.k-net.dk)
Date: Tue Mar 21 2000 - 10:01:12 EST


Den 20-Mar-00 13:12:16 skrev James Sutherland fĝlgende om "Re: Some questions about linux kernel.":
> On Sun, 19 Mar 2000 15:50:07 -0600, you wrote:

>>NOPE - if the process requests it and is granted it, then it should have
>>access to it. It is not up to the system to say "here it is, but don't use
>>that part of it, because I really didn't give it".

> malloc() just allocates address SPACE. TOUCHING the memory then
> populates that space, which is how I can use malloc() for a nice,
> simple sparse matrix implementation. (On Win32, you have to mess
> around trapping exceptions in userland and allocating the memory
> yourself...)

   Note that malloc() is documented as allocating memory, regardless of
whether you actually touch it or not. Any programmer relies on that.

>>We are talking about the sum of all concurrent requests, and the system
>>aborting when part of the requests already granted turns out to not be
>>granted.

> No. The malloc() call requested address space, and that succeeded -
> the address space was available.

> What is NOT available, however, is memory to populate that area fully.
> So what?

   So you have a broken malloc().

> I could well be using malloc() to allocate a SPARSE matrix,
> in which case I certainly do NOT want it to populate the whole thing!

   Then using malloc() to create the matrix in one go is the wrong thing to
do.

> I would be seriously irritated if your disk quota system denied me
> permission to create a sparse file on the basis that, if fully
> populated, it would overrun my quota. Why apply the same system to
> memory?

   An lseek()/write() combination is documented to permit the file system
to create a sparse file. malloc() etc. has no permission to create sparse
memory blocks. That's why.

Regards,

/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻTŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Rask Ingemann Lambertsen | E-mail: mailto:rask@kampsax.dtu.dk |
| Please do NOT Cc: to me or the | WWW: http://www.gbar.dtu.dk/~c948374/ |
| mailing list. I am on the list.| "ThrustMe" on XPilot, ARCnet and IRC |
| Which is worse: Ignorance or apathy? Who knows... Who cares... |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:33 EST