SlideShare a Scribd company logo
1 of 9
EXCEPTION
HANDLING
 Exceptions and interrupts are unexpected events
which will disrupt the normal flow of execution of
instruction(that is currently executing by processor).
An exception is an unexpected event from within
the processor. Interrupt is an unexpected event
from outside the process
 Whenever an exception or interrupt occurs, the
hardware starts executing the code that performs
an action in response to the exception. This action
may involve killing a process, outputting an error
message, communicating with an external device,
or horribly crashing the entire computer system by
initiating a “Blue Screen of Death” and halting the
CPU. The instructions responsible for this action
reside in the operating system kernel, and the code
that performs this action is called the interrupt
handler code. Now, We can think of handler code
as an operating system subroutine. Then, After the
handler code is executed, it may be possible to
continue execution after the instruction where the
execution or interrupt occurred.
EXCEPTION AND INTERRUPT HANDLING :
 Whenever an exception or interrupt occurs, execution
transition from user mode to kernel mode where the
exception or interrupt is handled. In detail, the following
steps must be taken to handle an exception or
interrupts.
 While entering the kernel, the context (values of all CPU
registers) of the currently executing process must first
be saved to memory. The kernel is now ready to handle
the exception/interrupt.
 Determine the cause of the exception/interrupt.
 Handle the exception/interrupt.
 When the exception/interrupt have been handled the
kernel performs the following steps:
 Select a process to restore and resume.
 Restore the context of the selected process.
 Resume execution of the selected process.
 At any point in time, the values of all the registers in
the CPU defines the context of the CPU. Another
name used for CPU context is CPU state.
 The exception/interrupt handler uses the same CPU
as the currently executing process. When entering
the exception/interrupt handler, the values in all
CPU registers to be used by the exception/interrupt
handler must be saved to memory. The saved
register values can later restored before resuming
execution of the process.
 The handler may have been invoked for a number
of reasons. The handler thus needs to determine the
cause of the exception or interrupt. Information
about what caused the exception or interrupt can be
stored in dedicated registers or at predefined
addresses in memory.
 Next, the exception or interrupt needs to be
serviced. For instance, if it was a keyboard
interrupt, then the key code of the key press is
obtained and stored somewhere or some other
appropriate action is taken. If it was an arithmetic
overflow exception, an error message may be
printed or the program may be terminated.
 The exception/interrupt have now been handled
and the kernel. The kernel may choose to resume
the same process that was executing prior to
handling the exception/interrupt or resume
execution of any other process currently in memory.
 The context of the CPU can now be restored for the
chosen process by reading and restoring all register
values from memory.
 The process selected to be resumed must be
resumed at the same point it was stopped. The
address of this instruction was saved by the
machine when the interrupt occurred, so it is simply
a matter of getting this address and make the CPU
continue to execute at this address.
THANK YOU

More Related Content

What's hot

What's hot (20)

Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Unit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureUnit 5 Advanced Computer Architecture
Unit 5 Advanced Computer Architecture
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Register Reference Instructions | Computer Science
Register Reference Instructions | Computer ScienceRegister Reference Instructions | Computer Science
Register Reference Instructions | Computer Science
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
Chapter 13 - I/O Systems
Chapter 13 - I/O SystemsChapter 13 - I/O Systems
Chapter 13 - I/O Systems
 
Distributed Operating Systems
Distributed Operating SystemsDistributed Operating Systems
Distributed Operating Systems
 
Monitors
MonitorsMonitors
Monitors
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
 
Parallel processing
Parallel processingParallel processing
Parallel processing
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFS
 
Semaphores
SemaphoresSemaphores
Semaphores
 
Disk structure
Disk structureDisk structure
Disk structure
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processor
 

Similar to Exception handling in Pipelining in COA

Operatingsystems lecture2
Operatingsystems lecture2Operatingsystems lecture2
Operatingsystems lecture2
Gaurav Meena
 
Operating System
Operating SystemOperating System
Operating System
guest8b0942
 

Similar to Exception handling in Pipelining in COA (20)

Interrupts
InterruptsInterrupts
Interrupts
 
Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdf
 
Operatingsystems lecture2
Operatingsystems lecture2Operatingsystems lecture2
Operatingsystems lecture2
 
Interrupts
InterruptsInterrupts
Interrupts
 
Interrupts in CPU
Interrupts in CPUInterrupts in CPU
Interrupts in CPU
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
Interrupts
InterruptsInterrupts
Interrupts
 
Comp App Lect 2.pptx
Comp App Lect 2.pptxComp App Lect 2.pptx
Comp App Lect 2.pptx
 
Operating System
Operating SystemOperating System
Operating System
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 
Program control
Program controlProgram control
Program control
 
IO hardware
IO hardwareIO hardware
IO hardware
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Operating system
Operating systemOperating system
Operating system
 
Instruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptxInstruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptx
 
Computer architecture presentation
Computer architecture presentationComputer architecture presentation
Computer architecture presentation
 
Ch01 introduction
Ch01 introductionCh01 introduction
Ch01 introduction
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
Techno-Fest-15nov16
Techno-Fest-15nov16Techno-Fest-15nov16
Techno-Fest-15nov16
 

Recently uploaded

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 

Exception handling in Pipelining in COA

  • 2.  Exceptions and interrupts are unexpected events which will disrupt the normal flow of execution of instruction(that is currently executing by processor). An exception is an unexpected event from within the processor. Interrupt is an unexpected event from outside the process
  • 3.  Whenever an exception or interrupt occurs, the hardware starts executing the code that performs an action in response to the exception. This action may involve killing a process, outputting an error message, communicating with an external device, or horribly crashing the entire computer system by initiating a “Blue Screen of Death” and halting the CPU. The instructions responsible for this action reside in the operating system kernel, and the code that performs this action is called the interrupt handler code. Now, We can think of handler code as an operating system subroutine. Then, After the handler code is executed, it may be possible to continue execution after the instruction where the execution or interrupt occurred.
  • 4. EXCEPTION AND INTERRUPT HANDLING :  Whenever an exception or interrupt occurs, execution transition from user mode to kernel mode where the exception or interrupt is handled. In detail, the following steps must be taken to handle an exception or interrupts.  While entering the kernel, the context (values of all CPU registers) of the currently executing process must first be saved to memory. The kernel is now ready to handle the exception/interrupt.  Determine the cause of the exception/interrupt.  Handle the exception/interrupt.  When the exception/interrupt have been handled the kernel performs the following steps:
  • 5.  Select a process to restore and resume.  Restore the context of the selected process.  Resume execution of the selected process.  At any point in time, the values of all the registers in the CPU defines the context of the CPU. Another name used for CPU context is CPU state.
  • 6.  The exception/interrupt handler uses the same CPU as the currently executing process. When entering the exception/interrupt handler, the values in all CPU registers to be used by the exception/interrupt handler must be saved to memory. The saved register values can later restored before resuming execution of the process.  The handler may have been invoked for a number of reasons. The handler thus needs to determine the cause of the exception or interrupt. Information about what caused the exception or interrupt can be stored in dedicated registers or at predefined addresses in memory.
  • 7.  Next, the exception or interrupt needs to be serviced. For instance, if it was a keyboard interrupt, then the key code of the key press is obtained and stored somewhere or some other appropriate action is taken. If it was an arithmetic overflow exception, an error message may be printed or the program may be terminated.  The exception/interrupt have now been handled and the kernel. The kernel may choose to resume the same process that was executing prior to handling the exception/interrupt or resume execution of any other process currently in memory.
  • 8.  The context of the CPU can now be restored for the chosen process by reading and restoring all register values from memory.  The process selected to be resumed must be resumed at the same point it was stopped. The address of this instruction was saved by the machine when the interrupt occurred, so it is simply a matter of getting this address and make the CPU continue to execute at this address.