Re: No clue as to Disk Defragmenter status
- From: DevilsPGD <spam_narf_spam@xxxxxxxxxxxx>
- Date: Fri, 31 Oct 2008 14:39:28 -0700
In message <BD284363-4A3C-4184-936C-F1501933B48B@xxxxxxxxxxxxx> "Brandon
Taylor" <donnie126_2002@xxxxxxxxxxx> was claimed to have wrote:
How in the world Microsoft managed to overcome the need to close all running
processes before you defragment your system is beyond me!
This is actually fairly easy. The physical data on disk, filesystem and
application levels are largely isolated from each other.
Normal applications cannot read/write clusters on the disk directly,
only files, and accessing a file means using an API. The defragment API
and file access APIs were designed to function together.
The way a defragger works is that it first copies a cluster, then
updates the file allocation tables to reflect the file's new location.
(Strictly speaking, defraggers don't do that, they just decide what
clusters to move and use a special defrag API call, Windows then moves
the cluster and updates the file allocation tables)
The Windows file APIs are smart enough to update the location on disk
(if the files are even being read from disk, ideally most file access
will get cached anyway) without the application being aware anything
happened. This is actually not too dissimilar to how disk caching
works, the application doesn't try to read from the disk cache, it
simply tries to read from the file and Windows figures out if the
portion of the file being requested is cached or not.