Polling VS Interrupts
Polling is a method by which a host waits for controller’s response. It is a looping procedure, reading the status-register over and over till the busy bit of status register becomes clear. The controller uses or sets the busy bit when it is busy at work on a command and clears the busy bit when it is ready to take the next command. The host signals its demand via the command-ready bit in the command-register. The host sets the command-ready bit when a command is accessible for the controller to execute. In the given example, the host writes out-put through a port, synchronizing with the controller by hand-shaking
- The host repetitively reads the busy bit till that bit turn into clear.
- The host sets the writes a bite into the data-outregister and write-bit in the command-register.
- The host sets the ready bit command.
- When the controller gets noticed that the command-re ady bit is set then it sets the busy bit. Advertisement
- The controller reads the command register and then gets the write command.
- It reads the data-out register to acquire the byte, and does the I/O to the device.
- The controller clears the command-ready bit and bit in the status register topoint out that the device I/O succeeded, and clears the busy bit to show that it is
A signal that acquires the attention of the CPU and is typically generated when I/O is required. For example, software interrupts are produced by a program demanding disk input or output.
Common Functions of interrupts
Hardware might trigger an interrupt at any time by sending a signal to the CPU, generally by
way-of the system bus.
■ Software can trigger an interrupt by executing a special operation called a system call also called a monitor call.
■ Whenever the CPU is interrupted, it stops what it is doing and instantly transfers execution to a static location which contains the starting address, where the service routine for the interrupt is situated.
■ The interrupt service routine executes; in the end, the CPU take up again the interrupted
■ The routine, in turn, would call the interrupt-specific handler.
■ A table for interrupt routine called as interrupt vector which has the addresses of all the
■ A exception/trap is a software-generated interrupt caused both by an error or a user request.
The operating system reserves the state of the CPU by the program counter and storing registers
■ Defines which type of interrupt has occurred:
– vectored interrupt system
■ Separate segments of code decide what action must be taken for each type of interrupt.
Interrupt time-line for a single process doing out-put is shown as:..
Polling Vs Interrupts
|Basic||CPU continuously checks device status whether it requires attention of CPU.||Device notify CPU that it requires CPU’s attention.|
|Mechanism||It is basically a protocol.||It is basically a hardware mechanism.|
|CPU||CPU has to wait and check whether a device requires servicing which waste a lot of CPU’s cycles.||When a device requires servicing the CPU is get disturbed which saves the CPU’s cycles.|
|Occurrence||CPU poll the device at the consistent intervals.||It can occurs at any instant of time.|
|Efficiency||Polling becomes inefficient whenever CPU infrequently finds a device ready for service||It becomes inefficient whenever devices keep on interrupting frequently.|