Interrupts allow external events to suspend and later resume processes running on a computer. They improve processor utilization by allowing the operating system to interrupt running processes to respond to external events like user input or I/O device completion. There are different types of interrupts including program-generated, timer, I/O, and hardware failure interrupts. When an interrupt occurs, the CPU saves its context and executes an interrupt handling routine that calls the appropriate interrupt service routine to handle the interrupt before resuming the original process.
Interrupts By: Mr. Irfanullah C/NO: 14 MS (Computer Science) University Of Peshawar
2.
In This DemonstrationWhat 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 Queries and Suggestions
3.
What Are Interrupts?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 process can be resumed. A way to improve processor utilization.
4.
Need For Interrupts?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
5.
Instruction Cycle AndInterrupts Without Interrupts Two steps ( cycles) Instruction Fetch Instruction Execute
Difference Interrupts andExceptions Two main types of events: i nterrupts 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 e.g., timer fires
10.
Classes Of InterruptsProgram 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.
How Interrupts AreHandled? 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.
I/O COMMUNICATION TECHNIQUESThree techniques are possible for I/O operations Programmed I/O Interrupt-driven I/O Direct memory access (DMA)
15.
Programmed I/O CPUwhile 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.
Interrupt-Driven I/O Similarto direct I/O but processor not required to poll device. I/O module will interrupt CPU for data exchange when ready
17.
Direct Memory Access(DMA) I/O exchanges occur directly with memory Requires DMA module on system bus Capable of mimicking CPU and taking over control of system from CPU DMA will use bus when 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
18.
Another Look atI/O Synchronous (Programmed I/O) - control returns to user program only upon I/O completion. Idle CPU until the next interrupt wait loop (contention for memory access). Asynchronous (Interrupt driven I/O) - control returns to user program before I/O completion. System call – request to the operating system to allow user to wait for I/O completion. Device-status table contains entry for each I/O device indicating its type, address, and state.