05/08/2025 2
What isInterrupt ?
An Interrupt is a signal that stops the normal
work of the computer to handle an important
task.
Example:
Playing a game and getting a phone call —
game stops, call is attended.
BSCS-4TH-EVENING
05/08/2025 5
Hardware Interrupt
Hardwareinterrupts are generated
by hardware devices when
something unusual happens; this
could be a keypress or a mouse
move or any other action.
BSCS-4TH-EVENING
6.
05/08/2025 6
Software Interrupt
ASoftware Interrupt is generated by a program to
request a special service from the operating system.
Software interrupts are often used for:
• System calls
• Handling exceptions
• Communicating with the operating system
BSCS-4TH-EVENING
7.
05/08/2025 7
Real-Life Example
Weare writing a document and press "Save"
The program sends a software interrupt to the OS to save your file on the
hard disk.
BSCS-4TH-EVENING
8.
05/08/2025 8
Why 256Interrupts?
Triggers software interrupt.
Example using x86 Assembly Language:
In x86-based computer the interrupt number is stored as an 8-bit value
An 8-bit number can represent values from 0 to 255 (in hexadecimal:
00h to FFh)
This gives a total of 256 possible interrupts.
Each interrupt number points to an Interrupt Service Routine (ISR)
through the Interrupt Vector Table (IVT)
BSCS-4TH-EVENING
9.
05/08/2025 9
What isthe Interrupt Vector Table (IVT)?
BSCS-4TH-EVENING
IVT is a special area of memory located at the start of system
memory(usually at address 0000:0000)
It contains 256 entries.
Each entry is 4 bytes:
1. 2 bytes for Offset (address within a segment)
2. 2 bytes for Segment (base address)
• Total size of IVT = 256 × 4 bytes = 1024 bytes (1 KB).
05/08/2025 11
Features ofSoftware Interrupt
Generated by software (programs).
Requests services like saving a file, printing, memory access.
Planned and controlled — written in the program code.
Helps in communication between software and OS (Operating
System).
BSCS-4TH-EVENING
12.
05/08/2025 12
Advantages ofSoftware Interrupts
Advantage Benefit
Priority Handling Urgent tasks processed immediately
Flexibility Custom tasks can be added easily
Uniform Interface Simplifies working across different hardware
Stability Protects system from crashes
Efficiency Reduces code, saves time and resources
Security Prevents unauthorized access
BSCS-4TH-EVENING