Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can other processes run during memory paging?

First off, take a single processor system with multiple processes running in pseudo-parallel. When a process triggers a page fault, will this force the CPU to stop executing all programs until the page is loaded from disk?

If so, does this change on a multi-core or multiprocessor system, or can the other processes continue to read and write to memory while the page fault is dealt with?

Thanks!

like image 730
drpepper Avatar asked Apr 08 '13 19:04

drpepper


2 Answers

First, scheduling does not work for processes but for threads. A page fault only suspends the thread incurring the fault (on Linux and Windows). The thread is descheduled and the CPU is free to do other work.

At the level of the OS interfacing hardware there is no synchronous IO anyway. It does not exist (at least with modern hardware). The OS does not sit in a tight spin-loop waiting for the hardware to signal IO completion. Instead, the thread is descheduled until the IO completed (or the respective wait handle becomes signaled).

like image 138
usr Avatar answered Oct 07 '22 13:10

usr


Yes, this is not a problem at all. Nobody in their right mind designs a multi-process OS that's unable to run multiple processes, nor would they arbitrarily block process A because B is waiting on a disk I/O.

like image 42
MSalters Avatar answered Oct 07 '22 11:10

MSalters