Caching, Buffering & Spooling — What’s the difference ?

In computing, there are many terms which are closely related. Often we understand them individually but comparing them and finding the differences can be a pain. The similar situation was faced by me and all other 32 students in a lecture when our professor posed this question, during my college years. Though we knew the terms but elaborating on the differences was tough.

These terms are not mutually exclusive and their functions are frequently combined but they have intended difference. Lets have a look on the differences between Caching, Buffering and Spooling:

Spooling :

  • Acronym of “Simultaneous Peripheral Operation On-Line”.
  • Its a process of placing data in temporary working area for another program to process.
  • E.g: Print spooling and Mail spools etc.
  • When there is a resource (like printer) to be accessed by two or more processes(or devices), there spooling comes handy to schedule the tasks. Data from each process is put on the spool (print queue) and processed in FIFO(first in first out) manner.
  • With spooling all process can access the resource without waiting.
  • After writing the data on spool, process can perform other tasks. And printing process operates seperately.
  • Without spooling, process would be tied up until the printing finished.
  • Spooling is useful for the devices which have differing data access rate. Used mainly when processes share some resource and needed to have synchronization.

Buffering :

  • Preloading data into a reserved area of memory (the buffer).
  • It temporarily stores input or output data in an attempt to better match the speeds of two devices such as a fast CPU and a slow disk drive.
  • Buffer may be used in between when moving data between two processes within a computer. Data is stored in buffer as it is retrieved from one processes or just before it is sent to another process.
  • With spooling, the disk is used as a very large buffer. Usually complete jobs are queued on disk to be completed later.
  • It is mostly used for input, output, and sometimes temporary storage of data either when transfer of data takes place or data that may be modified in a non-sequential manner.

Caching :

  • Caching transparently stores data in component called Cache, so that future request for that data can be served faster.
  • A special high-speed storage mechanism. It can be either a reserved section of main memory or an independent high-speed storage device.
  • The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere.
  • E.g: Memory Caching, Disk Caching, Web Caching(used in browser), Database Caching etc.
  • A cache’s sole purpose is to reduce accesses to the underlying slower storage.

NOTE :

  1. All three enhances performance and makes system faster.
  2. Caching usually used as a buffer.
  3. Spooling is better than buffering ( Buffering overlaps input, output and processing of a single job whereas Spooling allows CPU to overlap
    the input of one job with the computation and output of other jobs).

If you like what you read, kindly tap the ❤ button below — as writer it means the world. Want to discuss more, reach out at danish@pixelgenie.co

Like what you read? Give Danish a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.