2. What Are Interrupts?
Why Interrupts?
Instruction Cycle And Interrupts
Difference b/w Interrupts and Exceptions
Classes Of Interrupts
How They Are Handled?
I/O Communication Techniques
2
3. 3
A Suspension of a process such as the execution
of a computer program, caused by an event
external to that process, and performed in such a
way that the current process can be resumed.
A way to improve processor utilization.
4. 4
The OS is a reactive program
When you give some input
It will perform computations
Produces output BUT
Meanwhile you can interact with the system by
interrupting the running process or
You can stop and start another process.
This reactive ness is due to interrupts
Modern Operating Systems Are Interrupt driven
9. 9
Two main types of events: interrupts and
exceptions
Exceptions are caused by software executing
instructions
e.g., a page fault, or an attempted write to a read-
only page
an expected exception is a “trap”, unexpected is a
“fault”
Interrupts are caused by hardware devices
e.g., device finishes I/O
10. 10
Program
Generated by some condition that occurs as a result of an
instruction execution, such as arithmetic overflow,
division by zero, attempt to execute an illegal machine
instruction etc.
Timer
Generated by a timer within the processor. This allows the
operating system to perform certain functions on a regular
basis.
I/O
Generated by an I/O controller, to signal normal completion
of an operation or to signal a variety of error conditions.
Hardware failure
Generated by a failure, such as power failure or memory parity error.
11. 11
Different routines handle different interrupts –
called Interrupt Service Routines (ISR).
When CPU is interrupted
It stops what it was doing, and context is saved.
A generic routine called Interrupt Handling
Routine (IHR) is run which
Examines the nature of interrupt
Calls the corresponding Interrupt Service Routine
(ISR) -- stored in lower part of memory.
After servicing the interrupt, the saved address
is loaded again to PC to resume the process
again.
13. ts By: Irfanullah University Of Peshawar, 13
(Continued)
Interrupt
Processing
14. 14
Three techniques are possible for I/O operations
Programmed I/O
Interrupt-driven I/O
Direct memory access (DMA)
15. 15
CPU while executing a
program encounters an I/O
instruction
CPU issues I/O command to I/
O module
I/O module performs the
requested action & set status
registers
CPU is responsible to check
status registers periodically to
see if I/O operation is
complete. SO
No Interrupt to alert the
processor
16. 16
Similar to direct I/O but
processor not required
to poll device.
I/O module will interrupt
CPU for data exchange
when ready
17. Requires DMA module on system bus
Capable of mimicking CPU and taking over
control of system from CPU
DMA will use bus when
17
I/O exchanges occur directly with
memory
Processor does not require it
OR
Must force processor to
suspend operation
temporarily– called cycle
stealing
An interrupt is sent when the task
is complete
The processor is only involved at
the beginning and end of the
transfer