[openbeos] mmap, vm2 and you

  • From: "Michael Phipps" <mphipps1@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 05 Sep 2002 21:28:50 -0400

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. 

Anyway. What I wanted to ask you all is this - does anyone know of MAP_COPY or 
MAP_PRIVATE being used in real software? I can write cases for them, but it is 
more work and I thought that I would ask and see if anyone knows of people 
actually using them. It somewhat complicates things (and they are slower than 
their more public compatriots).


Other related posts: