2
$\begingroup$

I am quoting a paragraph in Operating System Concepts by Silberschatz, in paging chapter,

In addition, the operating system must be aware that user processes operate in user space, and all logical addresses must be mapped to produce physical addresses. If a user makes a system call (to do I/O, for example) and provides an address as a parameter (a buffer, for instance), that address must be mapped to produce the correct physical address. The operating system maintains a copy of the page table for each process, just as it maintains a copy of the instruction counter and register contents. This copy is used to translate logical addresses to physical addresses whenever the operating system must map a logical address to a physical address manually. It is also used by the CPU dispatcher to define the hardware page table when a process is to be allocated the CPU.

I don't understand why OS would copy the page table, isn't it the one creating and maintaining it?
And as given further, why does it keep copy of instruction counter and register contents?

$\endgroup$
4
$\begingroup$

why does it keep copy of instruction counter and register contents?

It's because of process scheduling.

Let's say a process comes in execution first time and executes some lines of instruction. The registers contain values as per the instructions executed till now. Now if the process switches from running state to waiting state (due to I/O or preemption) and then comes back to the running state, it must have the same register values for further execution. So OS stores a copy of each register in the program control block(PCB).

I don't understand why OS would copy the page table, isn't it the one creating and maintaining it?

Again, if the process goes out of execution, OS must save the information regarding frames of memory allocated to the process.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.