what has priority, interrupt or exceptions
A student writes. I realize you are deep into lab 6, but this is pretty
fundamental, so I thought I would respond.
Hello Dr. Patt and TAs,
How are you? I do have a few questions just out of curiousity.
When timer interrupt and exception(protection or unaligned access
as in Lab 4) happen at the same time, which one has higher priority
for the sake of Lab 4? What about in reality? I understand that
protection exception has higher priority than unaligned access
exception in Lab 4. Does it happen the same way in reality? Thanks.
<<name withheld to protect the student asking just out of curiosity>>
We need to go back to the lecture on interrupts and exceptions. When do
interrupts occur (or more importantly, get queried)? When do exceptions
Answer: Interrupts occur asynchronously with the running program because
they happen as a result of an event external to the running program. Therefore,
they can occur anytime. BUT they are only allowed to interrupt the processor
at instruction boundaries, that is between the end of one instruction and the
start of the next.
Exceptions occur as a result of some exceptional event occuring during the
processing of an instruction. AND, they almost always interrupt the processor
at the time they are detected.
Since an exception happens while an instruction is being processed, and an
interrupt is allowed to interrupt processing between instructions (i.e., while
no instruction is being processed), we never have to worry about choosing
between the two. Ergo, the notion of priority between the two has no meaning.
Good luck finishing Lab 6.