SanderR wrote:
Do I understand it well that paging is also used to make programs think they are in a memory region while in fact, they are in another region. like, program A is at 0xC00000 and program B is at 0xD00000 but they have a virtual address of 0x4000 ?
That is indeed one of the things you can do with paging.
SanderR wrote:
In the code produced by the tutorial, they give the physical address to the last directory, but this offset is calculated by a script with the input of a virtual address. does this mean you can only assign one physical page per virtual address?
Yes, but don't forget you can change the assignment whenever you like. A typical OS will have separate page tables for each program and update CR3 on each task switch. This is how you can have program A and program B both running at virtual address 0x4000. (This may or may not be possible using the tutorial code - I haven't checked, but it's common for tutorials to simplify things in order to better focus on specific topics.)