operating system os

OS Instruction Backup

« Previous Tutorial Next Tutorial »

When a program references a page that is not in the memory, then instruction causing the fault is stopped part way through and a trap to the OS occurs.

After the OS has fetched the needed page, it must restart the instruction causing the trap.

Now, in the figure given below, there is an instruction that starts at the address loss, makes the following three memory references:

operating system instruction backup

Now, depending on which memory references caused the page fault, the program counter might be 1000, 1002, or 1004 at the time of fault. Basically, it isn't possible for OS to specify unambiguously where the instruction began.

But, in some computer machines, the designers of the central processing unit provide the solution, generally in the form of hidden internal register into which the program counter is copied just before each and every instruction is executed.

These machines may also have another/second register that tells which registers have already been auto-incremented or decremented and also by how much amount.

Now with the above/this information, the OS can unambiguously undo all the effects of the faulting instruction so it can again be restarted all over.

« Previous Tutorial Next Tutorial »


Quick Links
Signup - Login - Give Online Test