Processes have to “remember” certain CPU registers.
Processes have to “remember” certain CPU registers. :crazy:Why don’t we put them in
a table just like memory or I/O information for OS to handle?:confused:
Re: Processes have to “remember” certain CPU registers.
In fact we do! When a process is started a process owns all user level registers and changes their contents all the time.
When the operating system changes a running process to an other (context switch), user registers are saved by operating system to a memory area controlled only by the operating system (as PCB, process control block). OS returns the values when we start the original process again.
Some architectures support saving registers by HW to memory when a special instruction is executed (Intel 386 saved registers to TSS (Task State Segment), but this is not currently used (?) for ex. with new Linux kernel and Intel processor even newest processors are still capable to do that).
If the question means that we give up registers and use only RAM, it is not good (fast) enough and possible. In fact some older processor architectures supported instructions "memory to memory" as
"Move a memory location x contents to a memory location y".
Even then we need some registers inside the processor as the instruction for ex. must be fetched to be executed.
|All times are GMT +5.5. The time now is 14:15.|