I was reading about the Long term scheduler, when I read that when memory is not enough and load on the CPU due to multiprogramming is too high, a process might be moved to secondary storage space (namely swap space). I am slightly confused as too what exactly happens when a process is moved out of memory. Is its "PCB(Process Control Block)" moved out and store in Hard disk or something else like "process state".

I believe that this confusion is due to lack of clarity between "process in memory" and "process control block". Are the two things different or the same?

process control Block process in memory

The above two diagrams have been picked from the 3rd chapter of Operating Systems Concepts 9th edition.


1 Answer 1


The point of swapping is to make room in RAM. What is moved to disk is what the book calls “process in memory”, not the process control block. The PCB block is a small amount of memory, so moving it to disk wouldn't help much. Additionally, some of the PCB is necessary even if the process is never scheduled, for example to know whether a file is open or not (which matters if the file is deleted or when taking a lock on the file), to know what events (such as I/O becoming available) might cause the process to become runnable (this information would be in the “process state”), and the knowledge of where the process data is in the swap space (that would be the process's “memory limits” while it's swapped out). In contrast, none of the process's own memory is necessary while the process is not scheduled.

Note that most operating systems don't swap out a whole process, but parts of its memory. Some books make a distinction between “swapping” a whole process and “paging” parts of memory, but in modern usage, the words “swapping” and “paging” are usually synonymous and refer to any mechanism that temporarily moves process memory to swap, whether it moves a whole process at a time (uncommon) or parts of process memory (common).

  • $\begingroup$ So, PCB somehow stores the "process in memory's" location in hard disk so that it can be fetched when whenever required. I had one more doubt, what happens during the "suspended wait" state that it is able to move to "suspended ready" state. Usually, a process which has been swapped is out of memory, so how is it able to do its I/O operations and go to suspended ready state? Reference: States of a process $\endgroup$
    – Puneet
    Oct 11, 2020 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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