Polling (computer science)

Polling referred to in the computer science, the method to determine the status of a device consisting of hardware or software or the event of a change of value by means of cyclic queries.

Use

Hardware whose status is required, often composed of ports of electrical circuits, interfaces and external devices. Software states that are frequently queried are file locks on computers or other semaphore.

One possible purpose of synchronization is the active waiting for state changes, also called spinning. Another form is a query once in each case in a sampling cycle, according to each of the query or some other activity.

An example of the use of polling is the polling.

Pros and Cons

Polling is useful under the following conditions:

  • The simple explicit serial and identifiable behavior of polling programming can be compared with potentially more complex parallel alternatives desirable.
  • It is a very fast query such as a hardware interface which will take the desired state within microseconds.
  • It is a cyclic activity present in the polling to take place, while alternative solutions require more effort. This is often the case with cyclic arrangements of the case.
  • There are no other connections to the partner except the query option. This is given as in loosely coupled systems, for example, when querying whether a file (possibly on a remote computer ) exists on a file system or is released that is provided by another program or is blocked.

Cons:

  • By polling is often the performance of programs non- deterministic ( eg varying FPS) and usually lower than with alternative solutions.
  • The efficiency of use of system resources may be significantly less than alternative approaches. For example, a naive polling implementation, such as a Polling to maximum speed program, the system load to 100% drive ( with unnecessary power consumption and waste heat), whereas an event-based or hardware interrupt solution consumes virtually no system resources.

Alternatives

There are the following alternatives to polling (usually the concept of Inversion of Control following), their applications depend on each of the hardware and software conditions:

  • Interrupt control, especially in Hardwareanschaltungen.
  • Event control and callback functions to, for example, to process user interactions,
  • Pushing of data, ie the (perhaps permanent ) Send unsolicited
  • Pulling data, ie the targeted, sporadic querying data
  • Use of a scheduler of a real-time operating system, in particular for Semaphorenabfrage (monitor) or for process synchronization with wait / notify.

Disadvantage of most of these alternatives is that these are techniques of parallel programming, and thus have potential risks and increased complexity compared to the explicit serial polling.

  • Operating system theory
  • Parallel processing
655207
de