Hugo <hugh<underbar>
2010-02-17 14:00:01 UTC
Hi
I'm unsure of something so want to pick the brains of anyone who might have
some further knowledge.
In an app that has a memory mapped file loaded, if it updates some mapped
pages and then does nothing else, then if I kill the app (e.g. with task
manager) the modified pages are written to disk, that is the updates are not
lost.
Further, if I run the same test but instead of killing the app, I just pull
power from the machine, the updates are lost and the files contents are
unmodified (or they might be if the OS paged the page out, but this is not
often the case).
Now my question:
If I run that same test, start the app, update some data in some mapped
pages and then (with the app running but idle) I do a system shutdown.
My understanding was that this operation would kill the processes (as I did
above with task manager) and then (eventually) finish the shutdown and power
off.
Because of this I have assumed that modfied pages would be written to disk
when I shutdown, much as they are when I just kipp a running app.
But is this true? I am seeing behaviour reported by a customer that suggests
a shutdown may actually kill processes more "brutally" and therefore might
not flush modfied pages to the mapped file.
I cannot find formal documentation on this anywhere.
If shutdown is more "dirty" in this scenario, then how can I detect shutdown
in my code? I'd ideally like to create either a handler or a dedicated thread
that gets signalled when shutdown occurs (this will be done inside our API
library DLL).
Handling it this was will mean we can handle it whether our library is used
in a windows app, a console app, a service etc and lets us handle it without
the user having to code for it.
Any info greatly appreciated.
H
I'm unsure of something so want to pick the brains of anyone who might have
some further knowledge.
In an app that has a memory mapped file loaded, if it updates some mapped
pages and then does nothing else, then if I kill the app (e.g. with task
manager) the modified pages are written to disk, that is the updates are not
lost.
Further, if I run the same test but instead of killing the app, I just pull
power from the machine, the updates are lost and the files contents are
unmodified (or they might be if the OS paged the page out, but this is not
often the case).
Now my question:
If I run that same test, start the app, update some data in some mapped
pages and then (with the app running but idle) I do a system shutdown.
My understanding was that this operation would kill the processes (as I did
above with task manager) and then (eventually) finish the shutdown and power
off.
Because of this I have assumed that modfied pages would be written to disk
when I shutdown, much as they are when I just kipp a running app.
But is this true? I am seeing behaviour reported by a customer that suggests
a shutdown may actually kill processes more "brutally" and therefore might
not flush modfied pages to the mapped file.
I cannot find formal documentation on this anywhere.
If shutdown is more "dirty" in this scenario, then how can I detect shutdown
in my code? I'd ideally like to create either a handler or a dedicated thread
that gets signalled when shutdown occurs (this will be done inside our API
library DLL).
Handling it this was will mean we can handle it whether our library is used
in a windows app, a console app, a service etc and lets us handle it without
the user having to code for it.
Any info greatly appreciated.
H