Subject: Re: POSIX shm_open() vs. mmap(MAP_ANON|MAP_SHARED)....
To: Greywolf <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 07/10/2003 12:37:59
[ On Wednesday, July 9, 2003 at 13:00:03 (-0700), Greywolf wrote: ]
> Subject: Re: POSIX shm_open() vs. mmap(MAP_ANON|MAP_SHARED)....
> Wow, a (vno_t *) NULL was supposed to allow one to create pre-cleared
> pages in memory?
Apparently. There is only one anonymous object in the system -- why
would you need a "fake" pathname to represent it? (there's no backing
store in that kind of device file :-)
> I have a question regarding mmap()ing /dev/zero:
> Purportedly this was used by crt0.o and/or ld.so to create blank spots
> into which to load the dynamic libraries. Surely the same thing could
> have been accomplished with *alloc() and a clear routine,
That would be _very_ expensive in terms of VM for every process since
every page would fault and copy-on-write every time!
> mmap() could just pre-zero whatever pages it maps.
Indeed mmap(MAP_ANON) memory is zero-filled (and must be else the
garbage it revealed may violate someones privacy because that garbage
would very likely have come from some other process)
Greg A. Woods
+1 416 218-0098; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>