On a different subject, Nicholas Ryan recently wrote:
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
Unless I misunderstand, this statement seems to imply that data written by
WriteFile (buffered) will appear in any memory mapped section for that file
in a coherent manner. Is that true? Documentation on the Win32
MapViewOfFile API says:
A mapped view of a file is not guaranteed to be coherent with a file being
accessed by the ReadFile or WriteFile function:
My question: ARE there cases where the data in a mapped section ARE coherent
with data written to the same file by WriteFile ?
Carl
When the file is memory mapped as data and CACHED IO is performed on it,
coherency is ensured.
This aint true for non-cached IO.
Regards, Dan
----- Original Message -----
From: “Carl Appellof”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Tuesday, March 11, 2003 6:46 PM
Subject: [ntfsd] Coherency - memory mapped & file write
> On a different subject, Nicholas Ryan recently wrote:
>
> > 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
>
> Unless I misunderstand, this statement seems to imply that data written by
> WriteFile (buffered) will appear in any memory mapped section for that
file
> in a coherent manner. Is that true? Documentation on the Win32
> MapViewOfFile API says:
>
> > A mapped view of a file is not guaranteed to be coherent with a file
being
> accessed by the ReadFile or WriteFile function:
> My question: ARE there cases where the data in a mapped section ARE
coherent
> with data written to the same file by WriteFile ?
>
> Carl
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
And if I recall corectly , even in the case of cached IO there is a big
coherency problem with networked (remote)
files in the case of writes.
Dan
----- Original Message -----
From: “Carl Appellof”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Tuesday, March 11, 2003 6:46 PM
Subject: [ntfsd] Coherency - memory mapped & file write
> On a different subject, Nicholas Ryan recently wrote:
>
> > 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
>
> Unless I misunderstand, this statement seems to imply that data written by
> WriteFile (buffered) will appear in any memory mapped section for that
file
> in a coherent manner. Is that true? Documentation on the Win32
> MapViewOfFile API says:
>
> > A mapped view of a file is not guaranteed to be coherent with a file
being
> accessed by the ReadFile or WriteFile function:
> My question: ARE there cases where the data in a mapped section ARE
coherent
> with data written to the same file by WriteFile ?
>
> Carl
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
Also, the original post was discussing NOT using cache manager - and
hence - the coherency provided by the Windows VMM and cache manager does
not apply.
/TomH
-----Original Message-----
From: Dan Partelly [mailto:xxxxx@rdsor.ro]
Sent: Tuesday, March 11, 2003 12:45 PM
To: File Systems Developers
Subject: [ntfsd] Re: Coherency - memory mapped & file write
And if I recall corectly , even in the case of cached IO there is a big
coherency problem with networked (remote)
files in the case of writes.
Dan
----- Original Message -----
From: “Carl Appellof”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Tuesday, March 11, 2003 6:46 PM
Subject: [ntfsd] Coherency - memory mapped & file write
> On a different subject, Nicholas Ryan recently wrote:
>
> > 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
>
> Unless I misunderstand, this statement seems to imply that data
written by
> WriteFile (buffered) will appear in any memory mapped section for that
file
> in a coherent manner. Is that true? Documentation on the Win32
> MapViewOfFile API says:
>
> > A mapped view of a file is not guaranteed to be coherent with a file
being
> accessed by the ReadFile or WriteFile function:
> My question: ARE there cases where the data in a mapped section ARE
coherent
> with data written to the same file by WriteFile ?
>
> Carl
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
—
You are currently subscribed to ntfsd as: xxxxx@inflectionsystems.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
Thanks for the opinons, folks. I’m concerned only with coherency between
LOCAL CACHED WriteFile calls and memory mapped reads of the same file on the
same system using my own application for both kinds of access.
Carl
“Dan Partelly” wrote in message news:xxxxx@ntfsd…
>
> When the file is memory mapped as data and CACHED IO is performed on it,
> coherency is ensured.
> This aint true for non-cached IO.
>
> Regards, Dan
>
>
How so? The original poster was just asking:
“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.”
By default, all file I/O is cached unless the handle was opened with the
non-buffering flag. Since he did not mention specifying that flag, the
default behavior for his code on a WriteFile would be for the memory
cache to be updated first, and the disk file updated only later on by
the lazy writer.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tom Hansen
Sent: Tuesday, March 11, 2003 11:41 AM
To: File Systems Developers
Subject: [ntfsd] Re: Coherency - memory mapped & file write
Also, the original post was discussing NOT using cache
manager - and hence - the coherency provided by the Windows
VMM and cache manager does not apply. /TomH
-----Original Message-----
From: Dan Partelly [mailto:xxxxx@rdsor.ro]
Sent: Tuesday, March 11, 2003 12:45 PM
To: File Systems Developers
Subject: [ntfsd] Re: Coherency - memory mapped & file write
And if I recall corectly , even in the case of cached IO
there is a big coherency problem with networked (remote)
files in the case of writes.
Dan
----- Original Message -----
From: “Carl Appellof”
> Newsgroups: ntfsd
> To: “File Systems Developers”
> Sent: Tuesday, March 11, 2003 6:46 PM
> Subject: [ntfsd] Coherency - memory mapped & file write
>
>
> > On a different subject, Nicholas Ryan recently wrote:
> >
> > > 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
> >
> > Unless I misunderstand, this statement seems to imply that data
> written by
> > WriteFile (buffered) will appear in any memory mapped
> section for that
> file
> > in a coherent manner. Is that true? Documentation on the Win32
> > MapViewOfFile API says:
> >
> > > A mapped view of a file is not guaranteed to be coherent
> with a file
> being
> > accessed by the ReadFile or WriteFile function:
> > My question: ARE there cases where the data in a mapped section ARE
> coherent
> > with data written to the same file by WriteFile ?
> >
> > Carl
> >
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@rdsor.ro To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@inflectionsystems.com To unsubscribe send a blank
> email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@nryan.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>