Wikipedia explains about "segmentation fault" in this way:
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system).
So, what is the mechanism for a program executor to know at runtime whether a memory the program attempts to get access to is actually allowed to access?