-1

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.

NimaJan
  • 162
  • 1
  • 13

1 Answers1

0

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.

user3344003
  • 20,574
  • 3
  • 26
  • 62