I saw a question similar to this one, and it was answered but the answer was kind of vague and I'm looking for a little more detail than that. The question I'm referring to is this one.

The answer simply states that there are more page tables, one for each process. And the same thing is said in the book that I'm studying from.

Quote (translated myself, so might not sound so great):

During the program execution, the CPU works with logical addresses. The logical address has to be translated into a physical address for which a special structure called page table is used. The operating system generates a page table for each process in execution.

Okay, so that seems to be clear. But the books seems to contradict itself later on, in the section which explains where and how these tables are stored. Here's what the book says:

In the simplest case, a page table can be stored in a set of registers. However, using registers for storing page tables is only satisfactory when the table is relatively small. In the situation where the table is larger it is kept in memory, and a special base register points to its location (Page Table Base Register - PTBR).

I guess you can already see my confusion here: The plural and singular just keep alternating so I'm not sure whether there is in fact one or more page tables. Later on the concept of the Translation Lookaside Buffer is introduced and it gets even more confusing.

My questions come down to this:

Is there a single page table where all the pages from different processes are mapped into different memory frames, or is there a page table for each process currently being executed? If the latter is true, then does the CPU have a separate PTBR for each of these tables? I mean that seems kind of impossible, since that register is physical which would imply that there needs to be a finite number of them. Or maybe a combination of these cases, where there is in fact a table for each process but the CPU operates only with one at a time with some kind of context-switching mechanism?

Thanks in advance.

  • $\begingroup$ You seem to have all the answers to your questions. What's the problem? $\endgroup$ – ultrajohn Feb 2 '19 at 14:31
  • $\begingroup$ In the last section of my question there is a question mark at the end of each of my sentence, implying that I'm guessing possibilities but still don't know which one is true $\endgroup$ – Koy Feb 2 '19 at 14:32
  • 1
    $\begingroup$ Each process has its own page table. PTBR contains the address of the page table of the currently running process. $\endgroup$ – ultrajohn Feb 2 '19 at 14:38
  • $\begingroup$ And while the CPU is running a process, where are all the other PTBR values kept (of the processes awaiting CPU)? $\endgroup$ – Koy Feb 2 '19 at 14:40
  • $\begingroup$ They are most likely managed, kept by the OS in the main memory. $\endgroup$ – ultrajohn Feb 2 '19 at 14:44

Your Answer

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

Browse other questions tagged or ask your own question.