System I/O and Program Buffers


A buffer is a temporary storage area, usually in RAM. The purpose of most buffers is to act as a holding area, enabling the CPU to manipulate data before transferring it to a device. Because the processes of reading and writing data to a disk are relatively slow, many programs keep track of data changes in a buffer and then copy the buffer to a disk. When input or output is saved up rather than sent off to its destination immediately, we say that it is buffered. There are two kinds of buffers for the enhancement of program performance: Our focus now is on how to use the latter—program buffers—to speed up file input and output:
The I/O processor gets the data from the system buffer, prepares it for storing on the disk, then deposits it on the surface of the disk.

Note that because your changes are initially stored in a buffer, not on the disk, all of them will be lost if the computer fails during an editing session. For this reason, it is a good idea to save your file periodically.