[openbeos] Re: mmap, vm2 and you

  • From: François Revol <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Fri, 06 Sep 2002 09:36:35 +0200 (MEST)

En réponse à Michael Phipps <mphipps1@xxxxxxxxxxxxxxxx>:

> I am finishing up adding the features to vm2 (the new virtual memory
> system) and I realized that there are some mmap issues.
> Specifically, there are two flags to mmap that we don't support as of
> yet. MAP_COPY and MAP_PRIVATE. Right now, if vm2 were in kernel land and
> bug free and fast, mmap'ing a file from two different processes would
> always work off of the same memory/disk, meaning that all changes are
> shared in real time. This is, I think, the normal usage. It also means
> that disk cache and mmap share the same data. So if a file is mmap'ed
> and another app writes to it, those changes are visible in the mmap. 
> One can argue if this is good or bad behavior. I am not even sure what
> the "right" behavior is. I don't see anything in the man pages or
> elsewhere that says explicitly that mmap uses a snapshot of the file at
> the time of execution of the mmap OR that mmap is always up to date with
> the file system. My intuition tells me that up to date is better. 

IIRC the mmap and file should be synchronised on call to msync(), which
copies the changed pages to the file and the changed chunks of the file to the 
mmapped area.
That's in the msync() man.

Sorry, can't help more for now :-(
(damn, you'll get full mmap() before I even publish my mmap() hack for R5 :P)


Other related posts: