Question

say there is a call to a subroutine Multiply. while the main function has called the subroutine and we are in the middle of the sub routine's execution an external interrupt occurs which also calls the same subroutine multiply. what will happen in that case?

Was it helpful?

Solution

When an interrupt occurs, the information about the running program is saved away and then the interrupt handler is started. This handler runs on a stack that is separate from the one that the interrupted program uses, so if the handler calls multiply it will have separate parameters, local variables, and return addresses from what the program had.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top