It is worthwhile to see if virtual memory solves or exacerbates the protection problems mentioned in the last chapter. Recall that we do not want malicious or errant programs writing into any region of memory that does not belong to them, and the OS must handcuff any that do. Some systems like the CDC use a separate field length register to compare the address against the allowed range of addresses for the currently running program. Other machines, such as the IBM mainframes, use a short key for each block of memory and compare it against the currently running program's key for equality. Surprisingly, virtual memory systems do not need any extra protection mechanisms because a program does not even "know" about addresses that are not currently mapped into its virtual address space. The only way a program can get at real memory location X is if X is in one of the frames currently allocated to the program via the page table. And since frames are allocated to jobs on an all or nothing basis, with no jobs sharing memory inside a single frame, it is impossible for one program to mess up another's memory. |