Record Locking Help ....

Ben Duncan bns
Tue Aug 16 07:20:32 PDT 2005


There is a msync that flushes the mmap page to write. There is a
sync or async setting one can use for guaranteeing atomicity.

Now, my NEXT questions is what happens with multiple opens on mmap?

If process A opens and initiates a mmap, then along comes process B,
then C, etc...,all reading/writing the same file and process A
ends, does it "CLOSE" and 'munmap' the mmap file? Does the next
process, B, need to establish a mmap for the file? If process A DOES NOT
'munmap' the file when it ends, how does the memory get freed when ALL
process's are done ?


Thanks ...

Roger Oberholtzer wrote:
> On Mon, 2005-08-15 at 23:19, Ben Duncan wrote:
> 

<SNIP>
> 
> With mmap files, there really is no flush in the traditional sense. If a
> memory page is 'dirty' (something has changed since taken from the disk)
> it will be saved automatically by the paging system upon which mmap is
> written. Initially it will (I think) be saved to your swap space (if
> memory is full) and, when the file is closed, all dirty pages are
> written. There may be a flag somewhere that tells the system to write
> dirty pages based on some other criterion. The virtual memory system
> takes care of all this. So, there is also no write() call...
> 
> 
-- 
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor



More information about the Linux-users mailing list