-2

I was reading about it and was thinking surely the queue first in first out system would make more sense than using a stack because the last instruction will become the first right because it's lifo?

2 Answers 2

2

The CPU does not store the instructions, it stores the instruction pointer, along with the state of the registers.

Think of putting a post-it in a book so you can get back to that page.

0

No. You have interrupts with same or different priorities. Interrupts with same priority will be handled in lifo order - but only one at a time. So that lifo queue would only ever have one entry. But with different priorities, a high priority interrupt can interrupt one with lower priority, so a stack is appropriate here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.