Polling (computer science)
Encyclopedia
Polling, or polled operation, in computer science
, refers to actively sampling the status of an external device by a client program as a synchronous activity. Polling is most often used in terms of input/output
, and is also referred to as polled or software driven .
Polling is sometimes used synonymously with busy-wait polling (busy waiting
). In this situation, when an operation is required the computer does nothing other than check the status of the device until it is ready, at which point the device is accessed. In other words the computer waits until the device is ready. Polling also refers to the situation where a device is repeatedly checked for readiness, and if it is not the computer returns to a different task. Although not as wasteful of CPU cycles as busy-wait, this is generally not as efficient as the alternative to polling, interrupt
driven .
In a simple single-purpose system, even busy-wait is perfectly appropriate if no action is possible until the access, but more often than not this was traditionally a consequence of simple hardware or non-multitasking
operating systems.
Polling is often intimately involved with very low level hardware. For example, polling a parallel printer port to check whether it is ready for another character involves examining as little as one bit
of a byte
. That bit represents, at the time of reading, whether a single wire in the printer cable is at low or high voltage. The instruction that reads this byte directly transfers the voltage state of eight real world wires to the eight circuits (flip flops) that make up one byte of a CPU register.
Polling has the disadvantage that if there are too many devices to check, the time required to poll them can exceed the time available to service the I/O device.
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...
, refers to actively sampling the status of an external device by a client program as a synchronous activity. Polling is most often used in terms of input/output
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...
, and is also referred to as polled or software driven .
Polling is sometimes used synonymously with busy-wait polling (busy waiting
Busy waiting
In software engineering, busy-waiting or spinning is a technique in which a process repeatedly checks to see if a condition is true, such as whether keyboard input is available, or if a lock is available. Spinning can also be used to generate an arbitrary time delay, a technique that was necessary...
). In this situation, when an operation is required the computer does nothing other than check the status of the device until it is ready, at which point the device is accessed. In other words the computer waits until the device is ready. Polling also refers to the situation where a device is repeatedly checked for readiness, and if it is not the computer returns to a different task. Although not as wasteful of CPU cycles as busy-wait, this is generally not as efficient as the alternative to polling, interrupt
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
driven .
In a simple single-purpose system, even busy-wait is perfectly appropriate if no action is possible until the access, but more often than not this was traditionally a consequence of simple hardware or non-multitasking
Computer multitasking
In computing, multitasking is a method where multiple tasks, also known as processes, share common processing resources such as a CPU. In the case of a computer with a single CPU, only one task is said to be running at any point in time, meaning that the CPU is actively executing instructions for...
operating systems.
Polling is often intimately involved with very low level hardware. For example, polling a parallel printer port to check whether it is ready for another character involves examining as little as one bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...
of a byte
Byte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...
. That bit represents, at the time of reading, whether a single wire in the printer cable is at low or high voltage. The instruction that reads this byte directly transfers the voltage state of eight real world wires to the eight circuits (flip flops) that make up one byte of a CPU register.
Polling has the disadvantage that if there are too many devices to check, the time required to poll them can exceed the time available to service the I/O device.
See also
- Pull technologyPull technologyPull technology or client pull is a style of network communication where the initial request for data originates from the client, and then is responded to by the server. The reverse is known as push technology, where the server pushes data to clients.. Usually, customers will look for a site and...
- Interrupt requestInterrupt requestThe computing phrase "interrupt request" is used to refer to either the act of interrupting the bus lines used to signal an interrupt, or the interrupt input lines on a Programmable Interrupt Controller...
- Select (Unix)Select (Unix)select is a system call and application programming interface in Unix-like and POSIX-compliant operating systems for examining the status of file descriptors of open input/output channels...
- KqueueKqueueKqueue is a scalable event notification interface introduced in FreeBSD 4.1, also supported in NetBSD, OpenBSD, DragonflyBSD, and Mac OS X. It's the foundation of Apple's Grand Central Dispatch....