If a process is suspended (swapped to secondary memory), then does the process control block also get swapped to secondary memory?

0

If a process is suspended (swapped to secondary memory), then does the process control block also get swapped to secondary memory? Or would the process control block remain in main memory, whilst the rest of the process is swapped out to secondary memory.

It seems to me that the process control block would have to remain in main memory; otherwise, in the future, how would the OS remember that there is a suspended process in secondary memory?

I would greatly appreciate it if anyone could please take the time to clarify these concepts.

handler's handle

Posted 2017-01-25T03:57:16.127

Reputation: 101

Suspension and being swapped out are not the same, but are two distinct conditions. A process can be suspended and still be memory resident. – sawdust – 2017-01-25T06:00:44.563

@sawdust Really? My textbook discusses them as being synonymous. I would appreciate it if someone could please confirm this. Also, do you have any information on the process control block concept I mentioned? – handler's handle – 2017-01-25T06:06:39.463

1

What textbook are you using that says swapping and suspension are synonymous? A process can be suspended due to waiting on I/O (disk/memory) but not be swapped. A swap can happen if the OS decides the process doesn't need to reside in main memory for one reason or another (process not used in a while, not enough memory), but whether or not the PCB is moved is OS dependent ..

– txtechhelp – 2017-01-25T07:41:46.323

@txtechhelp Thanks for the response. My textbook specifies that a process waiting on I/O is in the "blocked" state. I've only just begun reading about processes, so perhaps It will further clarify these differences in later chapters. So whether the PCB is swapped into secondary memory along with the rest of the process is dependent on the OS? – handler's handle – 2017-01-25T07:47:45.010

1It sounds like the book will clarify later and is just trying to simplify things in the beginning so as not to overwhelm; for example, you can disable swap space on OSes, as well, a lot of embedded systems don't have a swap, yet the OS will still put processes in a "suspended" (or "blocked") state. Process management is one of the main functions of an OS and thus differs from OS to OS; even between similar OS's (e.g. between variations of Windows, or Linux or Mac), so a direct answer to if the PCB is swapped depends on OS. – txtechhelp – 2017-01-25T07:57:11.177

@txtechhelp In that case, you've answered my question. Thank you again for the assistance. :) – handler's handle – 2017-01-25T08:11:49.790

Instead of using an edit you could formulate it as an answer, post it as such and accept it. – Seth – 2017-01-25T11:20:37.497

This question is ill-defined. The PCB is an abstract concept; as txtechhelp says, implementation details vary from OS to OS. Note that Wikipedia says, “At least part of the process control data structure is always … in main memory”. For example, in Unix, the conceptual PCB is divided into two parts: the proc structure, which is always in memory, and the user structure, which can be paged / swapped out to secondary storage when the process is. So there is no single answer to this question as written.

– Scott – 2017-09-28T02:34:19.697

Answers

0

I just found the answer to my question: For the purpose of remembering what is in main and secondary memory, the OS doesn't necessarily need to keep the PCB in main memory; rather, the OS maintains tables of the current status of each process and resource. For information about memory, the OS maintains memory tables which possess information on the allocation of main memory to processes, the allocation of secondary memory to processes, and other information.

handler's handle

Posted 2017-01-25T03:57:16.127

Reputation: 101

0

The process control block (PCB) is the space where the OS keeps records related to processes and it has to be available in main memory all the time. Process state is one of the fields in PCB and the OS will need this field to know that the process is currently which of the states i.e. Ready, Run, Suspend Ready, Wait/Block, Suspend Wait.

shantanu kaushik

Posted 2017-01-25T03:57:16.127

Reputation: 1