03 Oktober 2009

SPOOLING

In computer science, spooling refers to a process of transferring data by placing it in a temporary working area where another program may access it for processing at a later point in time. The term "spool" is an acronym of "Simultaneous Peripheral Operation On Line". The normal English verb "spool" can refer to the action of a storage device that incorporates a physical spool or reel, such as a tape drive; the acronym was presumably contrived by analogy.

Acronym for simultaneous peripheral operations on-line, spooling refers to putting jobs in a buffer, a special area in memory or on a disk where a device can access them when it is ready. Spooling is useful because devices access data at different rates. The buffer provides a waiting station where data can rest while the slower device catches up.

This temporary working area could be a file or storage device, but probably not a buffer. Usual uses of the term spooling apply to situations where there is little or no direct communication between the program writing the data and the program reading it. Spooling is often used when a device writes data faster than a target device can read it, allowing the slower device to work at its own pace without requiring processing to wait for it to catch up. Data is only modified through addition or deletion at the ends of the area, i.e., there is no random access or editing.

The most common spooling application is print spooling: documents formatted for printing are stored onto a buffer (usually an area on a disk) by a fast processor and retrieved and printed by a relatively slower printer at its own rate. As soon as the fast processor has written the document to the spool device it has finished with the job and is fully available for other processes. One or more processes may rapidly write several documents to a print queue without waiting for each one to print before writing the next. Spooler or print management software may allow priorities to be assigned to jobs, notify users when they have printed, distribute jobs among several printers, allow stationery to be changed or select it automatically, generate banner pages to identify and separate print jobs, etc.

The temporary storage area to which E-mail is delivered by a Mail Transfer Agent and in which it waits to be picked up by a Mail User Agent is sometimes called a mail spool. Likewise, a storage area for Usenet articles may be referred to as a news spool. (On Unix-like systems, these areas are usually located in the /var/spool directory.) Unlike other spools, mail and news spools usually allow random access to individual messages.

Origin of the term

"Spool" is supposedly an acronym for simultaneous peripheral operations on-line (although it may be a backronym), or as for printers: simultaneous peripheral output on line. Early mainframe computers had, by current standards, small and expensive hard disks.

In the latter 1960s and early 1970s, computers handled punch cards, and spooling systems such as HASP, FIDO, PATCHES, SHADOW & SHADOW II, Power, GRASP, and The Spooler found they could benefit batch programs by spooling card input and output. (Some centers directed punch card and printed output to tape for later processing. It has been suggested that the term 'spooling' may have derived from these reels or 'spools' of tape, although this etymology has not been sourced.)

The spooling mechanism

The entire key to spooling is asynchronous processing, where the program is not constrained by the speed of slow devices, particularly printers.

Printers are relatively slow peripherals. In comparison, disc devices and particularly CPUs are orders of magnitude faster. Without spooling print data, the speed of program operation is constrained by the slowest device, commonly printers, forcing the program to wait for the mechanical motion of the printer. Professionals say the program is 'print bound'.

For example, when a city prepares payroll checks, the actual computation may take a matter of minutes or even seconds, but the printing process might take hours. If the program printed directly, computing resources (CPU, memory, peripherals) would be tied up until the program was able to finish. The same is true of personal computers. Without spooling, a word processor would be unable to continue until printing finished. Without spooling, most programs would be relegated to patterns of fast processing and long waits, an inefficient paradigm.

Behind the scenes

A spooler contains two parts:

  1. an operating system extension that traps data destined for a printer and buffers it,
  2. a simple program that independently writes trapped data to the printer.

Without spooling

An application program may write print lines or pages intended for a slow physical printer. The operating system receives I/O requests (input/output), including print lines or pages. Without a spooler, the OS allows data to pass to the printer and the application program waits for completion before continuing.

With spooling

A spooling mechanism traps the I/O request, captures the output data, and releases the application to continue processing. As the application continues, the spooler writes the data to a disc file and, if it's not already running, it kicks off the other part of the spooler, the actual print routine. It reads the output lines and writes them to the printer, independent of the original application which may have already ended.

In practice

Spooling improves the multiprogramming capability of systems. Most programs require input and produce output. Without spooling, the number of tasks that could be multiprogrammed might be limited by the availability of peripherals; with spooling, a task doesn't need access to a real device.

Because disc drives are so much faster than printers, throughput radically improves by temporarily directing printer output to disc storage and retrieving it at leisure.


Tidak ada komentar:

Posting Komentar

komen komen ke my blog..
hayoo..