Two Saves One Switch
A timer interrupt arrives while process A is running, and the OS decides to switch to process B. Here is the sequence:
| # | Who acts | Action |
|---|---|---|
| 1 | hardware | timer interrupt fires |
| 2 | hardware | save registers, move to kernel mode, jump to the trap handler |
| 3 | OS | handle the trap, decide to switch, call switch() |
| 4 | OS | save registers, restore B's, change the stack pointer to B's kernel stack |
| 5 | OS | execute return-from-trap |
| 6 | hardware | restore B's registers, move to user mode, jump to B's PC |
Steps 2 and 4 both save registers. Which describes them correctly?
Sign in to answer questions and track your progress
Sign In