Information Technology Reference
In-Depth Information
users organize large amounts of storage, and they make it easy for users
to use different different programs to create, read, and edit, their data.
Controlled sharing. File systems include metadata about who owns
which files and which other users are allowed to read, write, or execute
data and program files.
Reliability. File systems use transactions to atomically update multiple
blocks of persistent storage, similar to how the operating system uses
critical sections atomically update different data structures in memory.
To further improve reliability, file systems store checksums with data to
detect corrupted blocks, and they replicate data across multiple storage
devices to recover from hardware failures.
Impact on application writers. Understanding the reliability and perfor-
mance properties of storage hardware and file systems is important even if you
are not designing a file system from scratch. Because of the fundamental lim-
itations of existing storage devices, the higher-level illusions of reliability and
performance provided by the file system are imperfect. An application pro-
grammer needs to understand these limitations to avoid having inconsistent
data stored on disk or having a program run orders of magnitude slower than
expected.
For example, suppose you edit a large document with many embedded im-
ages and that your word processor periodically auto-saves the document so that
you would not lose too many edits if the machine crashes. If the application
uses the file system in a straightforward way, several of unexpected things may
happen.
Poor performance. First, although file systems allow existing bytes in
a file to be overwritten with new values, they do not allow new bytes to be
inserted into the middle of existing bytes. So, even a small update to the
file may require rewriting the entire file either from beginning to end or at
least from the point of the first insertion to the end. For a multi-megabyte
file, each auto-save may end up taking as much as a second.
Corrupt file. Second, if the application simply overwrites the existing file
with updated data, an untimely crash can leave the file in an inconsistent
state, containing a mishmash of the old and new versions. For example, if
a section is cut from one location and pasted in another, after a crash the
saved document may end up with copies of the section in both locations,
one location, or neither location; or it may end up with a region that is a
mix of the old and new text.
Lost file. Third, if instead of overwriting the document file, the applica-
tion writes updates to a new file, then deletes the original file, and finally
Search WWH ::




Custom Search