Why is the context not saved in the process itself instead of the PCB?

168 Views Asked by At

I have read that when a context switch happens, the context of that particular process will be saved in the process control block. But I wonder why the context couldn't be saved in the process itself so the CPU only had to remind itself which process it had to resume instead of making a copy of the context to the PCB.

1

There are 1 best solutions below

0
user3344003 On BEST ANSWER

The context is saved in the Process CONTEXT Block. The state of a process is defined by the values in the process's registers. What you are suggesting would require having a separate set of registers for each process which would make hardware design a nightmare.

The CPU is only aware of the currently running process. If the Process Context Block were in the user address space of the process, its values would be inaccessible.