There is no OS-maintained concept of current file position between
different file handles. If you have two different processes writing to a
single file and you want to share some sort of current position value,
you’ll have to maintain a shared variable. This variable can be stored
in a section of the mapped file or in a separate piece of mapped memory
protected by a named mutex - it can even be a global in a shared .dll.
Since memory-mapping a file exposes the same pages used by the NT cache
manager to manage the filesystem cache for the file’s data,
modifications made by WriteFile (assuming you didn’t open the file with
the no-buffering flag) will immediately appear in the mapped memory, and
will be flushed out to disk by the lazy writer at some point in the
future.
- Nicholas Ryan
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Narendra Shah
Sent: Monday, March 10, 2003 10:47 AM
To: File Systems Developers
Subject: [ntfsd] Memory Mapped File PositionHi,
I want to create a memory mapped file to be accessed for R/W
by different processes. How do I share current position
within the mapped views(may be
offset) among processes while all the processes write to it.
The access can be serialized using say mutex.If I execute WriteFile and ReadFile would it write into the
memory or to the disk for this file. If it writes to the
disk, it will get slower losing the advantage of being mapped
to memory.Any enlightenment on this issue is greatly appreciated.
-Narendra
You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com