Information Technology Reference
In-Depth Information
} }
Application
Library
File System
Block Cache
Block Device Interface
Device Driver
Memory-Mapped I/O,
DMA, Interrupts
Physical Device
File System API
and Performance
Device Access
Figure11.7: Layered abstractions provide access to I/O systems such as
storage systems.
3. Write a program that creates a new file, writes 100KB to it, flushes the
writes, and deletes it. Time how long each of these steps takes.
Hint You may find the Posix system calls creat() , write() , fflush() ,
close() , and gettimeofday() useful. See the maual pages for details on
how to use these.
4. Consider a text editor that saves a file whenever you click a save button.
Suppose that when you press the button, the editor simply (1) animates
the button \down" event (e.g., by coloring the button grey), (2) uses the
write() system call to write your text to your file, and then (3) animates
the button \up" event (e.g., by coloring the button white). What bad
thing could happen if a user edits a file, saves it, and then turns off her
machine by flipping the power switch (rather than shutting the machine
down cleanly)?
11.3
Software layers
As shown in Figure 11.7, operating systems implement the file system abstrac-
tion through a series of software layers. Broadly speaking, these layers have two
sets of tasks:
API and performance. The top levels of the software stack|user-level
libraries, kernel-level le systems, and the kernel's block cache|provide a
convenient API for accessing named files and also work to minimize slow
storage accesses via caching, write buffering, and prefetching.
 
Search WWH ::




Custom Search