Eloff
Eloff

Reputation: 21656

Does a page fault cause a thread context switch on 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.

Upvotes: 5

Views: 617

Answers (1)

fuz
fuz

Reputation: 92966

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.

Upvotes: 4

Related Questions