WELCOME TO SHOTTING.CC
This is an explanation of how page tables work on a modern day computer. We have look up tables. Tables built on tables. One smaller table indexes a much larger table through virtual RAM addresses.
In systems programming, you'll encounter Page Tables frequently. And having to code for them in ASM is a PITA with all the bit shifting involved! But, once you have the routines set in stone down - you're laughing all the way to the bank.
Because, with page tables enabled in your OS - you're playing with the big boys such as Linux and M$/.
Well, It's rather simple. There is added protection to your code in RAM via the OS segment (ring 0). This code protection can mark your code segment as 'read-only' on the RAM page table entry. This read only is why you get a 'seg-fault' error when attempting to write to areas of RAM outside your own code and data segment. This IS a PITA for older developers who remain adamant that to this day writing to the full address space is THE way to program/ and sure enough, there's loads of tricks old coders know when a full RAM address is fair game. How about setting a pointer to 0x0000, then incrementing by one, writing 'A' as you go! Haha. That's one sure fire way to crash the OS and corrupt RAM.
But stuff like that is old school and doesn't work on modern operating systems that would throw a Page Fault Interrupt as soon as that code executed...