Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Operating System (http://www.go4expert.com/forums/operating-system-forum/)
-   -   Processes have to “remember” certain CPU registers. (http://www.go4expert.com/forums/processes-remember-cpu-registers-t27856/)

Sage_sage 21Feb2012 22:56

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:

_eb75_ 18Feb2013 16:32

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 09:45.