This article is more than 1 year old
Hackers' Paradise: The rise of soft options and the demise of hard choices
How it all went wrong for computer security
In the 1970s, mainframe computers began to give way to minicomputers. Although minicomputers were addressing a new and different market, they were architecturally descended from mainframes and retained many of the same features. The processors were still microcoded by the computer companies and thus did exactly what the designers wanted.
UNIX developers Ken Thompson and Dennis Ritchie working on a DEC PDP-11 minicomputer
In a typical 16-bit minicomputer, the address range could access 64K bytes, of which 8K of address space might be reserved for peripheral control. The addition of an MMU would allow 18-bit addresses to be created, meaning that 248Kbytes of memory would be accessible. These numbers seem small by the standards of today, but the principle can be applied to memories of any size.
When data/code corresponding to multiple users or programs is simultaneously in different areas of a large RAM, in order to change user or process it is only necessary to change the relocation constant so that the same CPU memory space is mapped to a different physical space. In this way, each program or user appears to have exclusive use of a virtual memory corresponding to the entire addressing range of the CPU. Alternatively, one user could have access to significantly more memory.
Fig.2, below, shows that typically peripheral addresses were at the top of physical address space, whereas the operating system would be resident at the bottom of physical memory, so that the machine could start up un-relocated and then configure the MMU. There would never be any ambiguity about handling conditions, such as interrupts or traps, because these would always force the program counter by hardware to an instruction at a constant physical location, which would be guaranteed to be in the operating system.
Fig 2: Typical minicomputer memory management system: the operating system in kernel mode is not relocated, except for the peripheral address page which is at the top of address space. Users A and B in user space both see the same unrestricted virtual address space which is relocated to different physical memory spaces. Users cannot access peripherals directly and have no access to the operating system
Since the full virtual address range of the CPU is mapped to RAM alone, it also follows that the user is unable to address peripherals. This can only be done via the operating system by submitting a request.
In the classic time sharing computer – apart from the operating system code area – one area of memory was currently in use by a process and being addressed by the CPU, one area was being prepared for the next user (by being loaded with the appropriate data from magnetic rotating memory) and a third area had just dropped out of use at the end of the previous time slice. That area of memory would need to be written back to the rotating memory, unless it had not been changed since it was loaded.
Another function of memory management was to determine if a given memory area had been modified since it was loaded. If no modification had taken place, the memory contents still reflected what was already on the rotating memory, so no write was needed, which saved time. The system worked rather like a juggler, where the balls in the air were in rotating memory and at the end of a time slice, one would come down into RAM and another one would go up to mass storage.
Since the MMU sits across the system bus, there isn’t much it doesn’t know, so it can tell if a given physical memory page is being read or written. If a page that is supposed to contain code that is only to be read sees an attempted write, it can prevent it and cause a trap.
In practice, MMUs were more complex than the simple example of Fig.1. The virtual address space from the CPU was broken into pages. These were contiguous in virtual space, but as Fig. 3 shows, there was no need for them to be contiguous in physical memory.
Fig.3: The use of page-based MMUs mean that contiguous virtual address space could be non-contiguous in physical memory. Any page that has not been modified need not be written back to rotating storage before being overwritten
An MMU could have one relocation constant per page and pages could be placed in any available physical memory space. The use of more and smaller pages meant that fewer of them would be modified, needing less to be written back to rotating memory.