0

When a process is changing its status from running to nonrunning (ready, waiting,...), either by itself or by scheduler, are all the pages used by the process and not shared with other running processes swapped out of the main memory?

Or is it possible that when a process is not running, some pages used by the process and not shared with other running processes are still in the main memory?

Thanks.

1

No, generally a non-running process’ pages remain as-is. It will only be swapped out if memory pressure requires it to be, and then only pages which haven’t been used recently.

Most processes switch from running to non-running multiple times a second, and spend most of their lives in a non-running state; imagine the performance impact if all processes were swapped out when they weren’t running... (You can see this happen if you leave a desktop environment running overnight, and have a background job run during the night which takes up a lot of memory. The desktop environment’s processes, which are inactive, will be swapped out — and you’ll have to wait quite a while in the morning for the system to become responsive again.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.