lkml.org 
[lkml]   [2000]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Overcommitable memory??
On Thu, 16 Mar 2000, James Sutherland wrote:

> On Wed, 15 Mar 2000, Paul Jakma wrote:

> That doesn't happen. malloc() ALLOCATES the memory to the process. It is
> *NOT* overcommitted. It may be backed by swapspace rather than physical
> memory, but that block of memory *IS* available to the process.
>

so malloc() isn't overcommited? malloc()'ed memory is guaranteed to be
available - ie the memory is reserved and accounted for at malloc()
time?

(i always thought malloc()'s were noted by the kernel ie in the page
table for the process, but that the kernel didn't actually allocate a
real page until the process tried to access that page - ie malloc() is
overcommited)

If so, how do we get into trouble?

> malloc() does this. fork() doesn't, because there is no memory to
> allocate.

i must be misunderstanding you, cause I'm pretty sure fork() is supposed
to copy the complete VM of the parent. :) And on older Unix's like
ultrix you really had to have lot's of swap if you wanted to allow big
processes to do a fork().

> The whole point of fork() is that you are *NOT* simply
> duplicating the in-VM image of the process!

no, the whole point of overcommiting is so that we don't have to copy
the VM of a process at fork() time, eg COW. But fork() does specify that
the child process will have a complete copy of the parents VM.

(whether we copy it at fork() time like really ancient os's, COW with
reserved backing store like ultrix or COW overcommit like linux is an
implementation issue).

> > but that only applies to processes that try malloc() at the point of
> > OOM. You still have a bunch of processes with memory they have already
> > malloc()'ed but havn't allocated yet.
>
> Nope.
>

really really sure about this? cause it goes completely against my
understanding of how linux works. but i'd be very glad to be corrected
if i'm wrong. I've honestly thought that malloc() was overcommited up
till now.

>
>
> James.
>

-paul.


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:2.123 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site