Reputation: 63
When CPU receives an interrupt, it completes execution of the current instruction and saves all the relevant process information of the current process on the stack, puts it in suspend state and moves on to service the interrupt. After servicing the interrupt, the CPU resumes execution of the original instruction, hence state changes from suspend to run. Can this state change be not done in any case? I read somewhere that this state change may not always be true. How?
Upvotes: 0
Views: 1246
Reputation: 21667
Very little of what you said is correct. First of all, the processor may or may not complete the instruction. Some processors have lengthy instructions that are interruptible.
I don't know of any operating system that puts a process in a suspended state when an interrupt occurs. Usually the current process handles the interrupt. Some operating system have a stripped down process context during interrupts but the processor believes the current process is handling the interrupt.
The interrupt handler usually ends with a return from interrupt instructions that returns from kernel mode and resumes the interrupted process execution stream.
Upvotes: 0