What is buffering and spooling in a batch processing operating system?

Operating SystemHardwareSoftware & Coding

To improve the performance and to avoid the CPU idle time the operating system uses two approaches which are explained below in detail.

Buffering

It is a method of overlapping input, output and processing of a single job.

After reading the data, the CPU is about to start operating on it, the input device is instructed to begin the next input immediately. The CPU and the input device are both busy. By the time the CPU is ready for the next data item the input device will have to finish its reading.

The CPU then begins processing the next data while the input device is ready for the following data. In case of output, the CPU creates data that is placed into a buffer until an output device is ready to accept it.

If the CPU is faster than the input device then buffering will be of little use, if the CPU is always faster than it always finds an empty buffer and has to wait for the input device. Also for output, the CPU must wait for the output device, because the CPU is faster than the output device.

Since the CPU is faster than the input /output device the speed of execution is controlled by the I/O device not by the speed of the CPU.

Spooling

It is called simultaneous peripheral operation online. Simultaneous means if two or more users issue the print command and the printer can accept requests even if it is printing some other jobs.

The cards are read directly from the card reader on to the disk. The location of the card images is recorded in a table kept by the operating system. When a job is executed, the operating system satisfies its request for card reader input by reading from the disk.

Similarly, when the job requests the printer to output a line, that line is copied into a system buffer and is written to the disk. Whenever the job is completed, the output is printed. This form of processing is called spooling.

Spooling is mainly used for data processing at remote sites. It overlaps the I/O of one job with the computation of other jobs. Spooling can keep both the CPU and I/O devices watching at much higher rates.

The figure given below depicts the spooling approach −

raja
Updated on 29-Nov-2021 09:54:31

Advertisements