Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does page fault necessarily cause context switch in Linux?

While I understand that some context switches are caused by page faults, does a page fault definitely cause context switch?

like image 859
dalibocai Avatar asked Jan 25 '26 05:01

dalibocai


1 Answers

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).

like image 76
Emisilve86 Avatar answered Jan 26 '26 21:01

Emisilve86