Spooling, Buffering & Caching—What’s The Difference??
In computing, there are many terms which are closely related and we often know them individually but comparing them and telling the difference between them can be a pain. The same situation was faced by me and all other 32 students in the room during a lecture when our professor posed this question. Though we knew the terms but telling the difference was tough.
These terms are not mutually exclusive and their functions are frequently combined but they have intended difference.
- 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.
- 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 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.
- All three enhances performance and makes system faster.
- Caching usually used as a buffer.
- 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).