Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a page fault cause a thread context switch on Linux?

Tags:

c

linux

If a thread suffers a major fault while trying to read from an address, and the data must be swapped in from "disk", does Linux take advantage of that to run another waiting thread, if there is one?

From what I've read online, the answer is yes. But I haven't seen anything conclusive.

like image 916
Eloff Avatar asked Sep 26 '22 17:09

Eloff


1 Answers

That depends on the scheduler you use. In general, the answer is yes, unless the disk operation is sufficiently fast or unless the kernel has another reason not to swap in a different process.

like image 199
fuz Avatar answered Oct 12 '22 10:10

fuz