2. Spooling
• SPOOL - Simultaneous Peripheral Operation
On- Line.
• Spooling overlaps input of one job with the
computation of other job.
3. How Spooling Works
• It involves a secondary memory which is used to hold
data till the device is ready to operate on this data.
• When device get ready the data is loaded onto main
memory for required operations.
CPU
Main
Memory
When Operating Systems were being built, CPUs executed instructions to give us output based on the input we provided, however, I/O operations took more time than CPU took to execute them. So, CPUs had to be put into an idle state till the instruction is processed by the I/O device and then the output is shown. After this another process will start . From this we can understand that the CPU was most of the time idle, which is the worst condition that we can have in Operating Systems. Here, the concept of Spooling comes into play.
so, This allow more I/O operation to be carried out simultaneously and enable us to experience faster applications of our peripheral devices.
Lets take and interesting example that we have all experienced. When your operating system hangs for any particular reason or your keyboard stops working while you are typing, have you noticed how all the alphabets that you pressed after the system hung suddenly get typed out very fast on their own even though you are not typing anymore. So, how this is working.
Lets see the inner working of it with the help of spooling in printer.
Read ppt.
The documents which are to be printed are stored in the secondary memory and then added to the queue for printing. During this time, many processes can perform their operations and use the CPU without waiting while the printer executes the printing process on the documents one-by-one.
After the CPU generates some output, this output is first saved in the main memory. This output is transferred to the secondary memory from the main memory, and from there, the output is sent to the printer.
The number of operations does not matter. Many I/O devices can work together simultaneously without any disruption to each other.
Less interaction is needed between the I/O devices and the CPU. That means there is no need for the CPU to wait for the I/O operations to take place because these operations take more time to finish executing, so the CPU will not wait for them to finish.
When there was no spooling process, CPU used to be in idle state at the time of input and output which is not considered very efficient. So spooling keep the CPU busy most of the time and only goes to the idle state when the queue is exhausted. So, all the tasks are added to the queue, and the CPU will finish all those tasks and then go into the idle state.
It allows applications to run at the speed of the CPU while operating the I/O devices at their respective full speeds.
Spooling requires a large amount of storage depending on the number of requests made by the input and the number of input devices connected.
If many input devices work simultaneously, they may take up a lot of space on the secondary memory and thus increase disk traffic. This results in the disk getting slower and slower as the traffic will increase.
Spooling is used for copying and executing data from a slower device to a faster device. This process in itself makes Spooling ineffective to use in real-time environments where we need real-time results from the CPU. This is because the input device is slower and thus produces its data at a slower pace while the CPU can operate faster, so it moves on to the next process in the queue. This is why the final result or output is produced at a later time instead of in real-time.