Reputation: 2347
While I understand that some context switches are caused by page faults, does a page fault definitely cause context switch?
Upvotes: 3
Views: 2832
Reputation: 354
Yes. If this happens because your program in user-mode leads to a "page_fault" the CPU in which it is running receives the interrupt of "page_fault" and the context of the current execution must be saved in the system's stack space (typically is the firmware to do this) so that the control is passed to the handler of "page_fault" ("ENTRY(page_fault)" defined in /kernel/entry.S).
Upvotes: 1
Reputation: 61
The page fault can be occured in user mode or kernel mode. If it's occured in user mode, regardless of the result, resulting in a context switch. And occured in kernel mode, in addition to context switch, as accessing address 0 can lead to kernel panic.
Upvotes: 0