Writing Sequentially and Effectively

This lesson describes how LFS uses write buffering to ensure efficient writes.

We'll cover the following

Write buffering

Unfortunately, writing to disk sequentially is not (alone) enough to guarantee efficient writes. For example, imagine if we wrote a single block to address AA, at time TT. We then wait a little while and write to the disk at address A+1A + 1 (the next block address in sequential order), but at time T+δT +\delta. In-between the first and second writes, unfortunately, the disk has rotated. When you issue the second write, it will thus wait for most of a rotation before being committed (specifically, if the rotation takes time TrotationT_{rotation}, the disk will wait TrotationδT_{rotation}-\delta before it can commit the second write to the disk surface). And thus you can hopefully see that simply writing to disk in sequential order is not enough to achieve peak performance. Rather, you must issue a large number of contiguous writes (or one large write) to the drive in order to achieve good write performance.

To achieve this end, LFS uses an ancient technique known as write buffering.

Get hands-on with 1200+ tech skills courses.