2002-09-20 21:13:37

by Russ Lewis

[permalink] [raw]
Subject: is any virtual address space reserved?

Is any of a userland application's virtual address space reserved?
Certainly, some memory is used at startup: the code is loaded into some
of the virtual space, as well as the stack. There needs to always be
enough space for the stack to grow as necessary. But is any of the
space actually marked off as "reserved"? If we just mmap'ed the same
file over and over again, could we fill the 4Gb address space with
identical mappings, or would we run out?

Russ

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]



2002-09-20 22:06:25

by Rik van Riel

[permalink] [raw]
Subject: Re: is any virtual address space reserved?

On Fri, 20 Sep 2002, Russ Lewis wrote:

> Is any of a userland application's virtual address space reserved?
> Certainly, some memory is used at startup: the code is loaded into some
> of the virtual space, as well as the stack. There needs to always be
> enough space for the stack to grow as necessary. But is any of the
> space actually marked off as "reserved"? If we just mmap'ed the same
> file over and over again, could we fill the 4Gb address space with
> identical mappings, or would we run out?

There are a number of issues here:

1) userspace has 3 GB space, kernel has the other 1 GB

2) if you want to mmap a file over and over again, you'll
need to have the code that maps the file and the glibc
mmap(3) stuff mapped into your address space ;)

3) your process will want to have a stack somewhere

4) address 0 is reserved to trap NULL pointer dereferences
both in kernel and user space

cheers,

Rik
--
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/ http://distro.conectiva.com/

Spamtraps of the month: [email protected] [email protected]