Disk Device - Overview

Disk Device

We present both the disk device and the SLU here as they are different types of devices, and therefore make for good examples. The main difference between the two is that the SLU is a character-oriented device (reads and writes one character at a time), while the disk device is a block-oriented device (reads and writes a block - or a sequence of bytes at a time). The second difference is that disk devices are often DMA devices - whereas SLUs are not. Because of these differences, they look a bit different to the O/S programmer.

A disk logically consists of a sequence of blocks (typically 512 bytes each or bigger). The only I/O that's allowed is to read or write an entire block at a time - you cannot read or write any less than that. Thus if you want to change a single character in a file, the entire block containing that character must be read in (if you need the original character to compute the new one), the character updated, and then the entire block written out. Some disk devices will allow the reading or writing of a series of blocks with one I/O operation, others will not.

1