lkml.org 
[lkml]   [2000]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Some questions about linux kernel.
On Sun, 19 Mar 2000, Jesse Pollard 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() does grant you what you (the process) asked for: it extends your
valid address space. It does not grant you any bit of RAM (page-frames
will be allocated when you access them, if available, or the process will be
put to sleep) or swap space (with overcommitting, it will be allocated when
the pages are paged-out). If you want the kernel to *grant* something,
you'll have to ask for it. You want RAM, not just VM, use mlock(). You don't
need RAM, but you need safe backing store, just create a file, fill it, and
mmap() it. If applications die because they treat malloc() as mlock(), it's
programmer's fault, not a kernel issue. malloc() it's just an interface to
brk(): it does not "allocate" anything (despite of the name) (kernel Gurus:
maybe it allocates PTEs and other kernel resources, ok...).
So when you access that part of your address space, you should be prepared
in doing I/O instead of memory access (most applications are unaware of it,
just because they need not to know... but applications depending on
performances, such as benchmarks, WILL notice it), or even expect a failure.

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

AFAIK, when you're requesting for RAM, mlock() will either fail at once or
succeed. The same is true when you are requesting disk space by means of
write()ing a file. Kernel Gurus please correct me if wrong: when you
mmap(,,,MAP_SHARED,,) you should not hit on swap... any changes should be
written (synced) directly to the file, right? And if you don't mlock() it,
the kernel will treat that part of your address space just like the other
(non locked) ones, reclaiming allocated page-frames when they're needed...

> -------------------------------------------------------------------------
> Jesse I Pollard, II
> Email: pollard@cats-chateau.net
>
> Any opinions expressed are solely my own.

.TM.
--
____/ ____/ /
/ / / Marco Colombo
___/ ___ / / Technical Manager
/ / / ESI s.r.l.
_____/ _____/ _/ Colombo@ESI.it


-
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:0.260 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site