You are on page 1of 2

Functions of ISR ( Interrupt service routine) :

ISR is also called device driver in case of the devices and called exception or signal or trap
handler in case of software interrupts. The functions of ISR are:

 It determines which hardware device requires servicing

 performs some kind of servicing of that hardware (usually this is done by simply reading
and/or writing the hardware's registers)
 updating some data structures shared between the ISR and some of the threads running in the
application
 notifying the application that some kind of event has occurred

Difference between subroutine and ISR

 A subroutine is called by a program instruction to perform a function needed by the


calling program.
 An interrupt-service routine is initiated by an event such as an input operation or a
hardware error. The function it performs may not be at all related to the program being
executed at the time of interruption. 
 Subroutine runs when you call it. ISR runs whenever a certain signal occurs.
 The main difference is that you know where the subroutine runs (because you call it). But
you do not know when the ISR will be executed.

Difference between programmed i/o and interrupt initiated i/o

Programmed I/O Interrupt Initiated I/O

 Data transfer is initiated by the means of


instructions stored in the computer
program. Whenever there is a request for  The I/O transfer is initiated by the
I/O transfer the instructions are executed interrupt command issued to the
from the program. CPU.

 There is no need for the CPU to


 The CPU stays in the loop to know if the stay in the loop as the interrupt
device is ready for transfer and has to command interrupts the CPU
continuously monitor the peripheral when the device is ready for data
device. transfer.
Programmed I/O Interrupt Initiated I/O

 The CPU cycles are not wasted as


 This leads to the wastage of CPU cycles as CPU continues with other work
CPU remains busy needlessly and thus the during this time and hence this
efficiency of system gets reduced. method is more efficient.

 CPU cannot do any work until the transfer  CPU can do any other work until
is complete as it has to stay in the loop to it is interrupted by the command
continuously monitor the peripheral indicating the readiness of device
device. for data transfer

 Its module is faster than


 Its module is treated as a slow module. programmed I/O module.

 It can be tricky and complicated to


understand if one uses low level
 It is quite easy to program and understand. language.

 The performance of the system is severely  The performance of the system is


degraded. enhanced to some extent.

How the time used in polling process reduced than in interrupt i/o ?

Polling can be more efficient and less time consuming than interrupt-driven I/O. This is the case
when the I/O is frequent and of short duration. Even though a single serial port will perform I/O
relatively infrequently and should thus use interrupts, a collection of serial ports such as those in
a terminal concentrator can produce a lot of short I/O operations, and interrupting for each one
could create a heavy load on the system. A well-timed polling loop could alleviate that load
without wasting many resources through looping with no I/O needed.

Note :

Two Priority scheme : Explain about Polling and Multiple priority scheme

Two Interrupt Priority : Multiple priority, Daisy Chain

You might also like