Virtual Memory for Microcomputers (MMU Comparison)
Total Page:16
File Type:pdf, Size:1020Kb
Virtual Memory for Microcomputers Four New Memory-Management Chips Pave the Way Stephen Schmitt 2890 Sandhill Rd. Mason, MI 48854 Not too long ago, a microcomputer one answer. Virtual memory is an NS16082 is another interesting MMU system with 32K bytes of memory automatic system for controlling very that merits analysis.] Finally, I will was considered a luxury. Because big memories. But special hardware discuss some implications and ap memory was very expensive, you functions are essential for building plications of virtual memory in took great pains to squeeze, pack, such a system. And now, single-chip microcomputer systems. and cram programs into the small memory-management units (MMUs) amount of memory that you could af have been developed to provide these Program Folding ford. Today, however, you can buy capabilities for microcomputers. Almost every computer system has 256K bytes for less than $500. And In the first part of this article, I will several types of memory devices that new 16- and 32-bit microcomputers introduce some of the basic concepts differ in speed and storage capacity. feature directly addressable storage A fundamental tenet of computer spaces that are 100 to 10,000 times technology states that memory price larger than those found in 8-bit archi Virtual memory is a is directly related to its speed. Storage tectures. Like the pauper who just powerful concept. It hierarchies thus usually represent an became rich, how do you handle this allows you to consider effective compromise between a vast wealth? large, slow, inexpensive memory and Another drastic change in the main memory to be a small, expensive one with high ac microcomputer world deals with soft very large-much larger cess speed. Familiar examples of this ware. Multitasking operating sys than its actual physical are systems with relatively small tems, high-level languages, and flexi size. amounts of fast RAM (random-access ble business software have become read/write memory) and larger, popular. The problem is now more slower, and cheaper disk-storage complex: How do we take advantage of virtual memory. Next, I'll compare devices. of both the increased hardware power and evaluate four MMU chips that Although the cost benefit of such a and the new complex software? have recently become available: configuration is substantial, the effi Virtual-memory techniques offer Intel's iAPX 286, Motorola's cient management of this structure MC68451, and Zilog's Z8010 and presents a challenge. The movement Z8015. [This survey does not include About the Author of data between these two hierarchy Stephen Schmitt has worked for Hewlett the National Semiconductor NS16082 levels should be minimal; otherwise, Packard and also taught at Michigan Techno MMU for the NS16032 microproces the access time for the slow memory · logical University. He now doing a review of is sor. Because of its fairly recent in will predominate over the speed of a version of the Ada programming language troduction, the part was not the fast memory. In a typical two for microcomputers. evaluated for the review. The level system, main memory (MM) is April 1983 © BYTE Publications :210 Inc 1000 to 5000 times faster than the gram logic is simpler and is focused by a program. The user does not have magnetic disks used for secondary on problem solutions, not critical to estimate memory allocation prior storage. Thus, disk accesses should be resource management. to execution. as infrequent as possible if we are to The objective of virtual memory is • Manual folding is eliminated and take advantage of the high speed of straightforward: to permit programs replaced, in part, by high-speed hard the main memory. with very large address spaces to run ware. Thus, programming costs tend Another problem is that the at MM speeds. In virtual systems, to be lower. relatively small size of the main main memory serves as a window (or • Programs execute correctly regard memory in most systems limits pro group of windows) onto the entire ad less of actual main-memory size. But gram size. An excessively large pro dress space held in secondary mem note that the execution speed may be gram must be broken into parts; each ory. If the window is big enough, and affected if the fast store is too small to piece is loaded into main memory if it accurately reflects the active part meet average memory requirements. prior to its processing turn and of total memory, the technique works • Relocation and task switching are returned to disk after execution. This extremely well. enhanced indirectly. technique is called folding or overlay The reason for this is that programs • Multiprogramming environments ing, and the task of folding programs tend to access small portions of mem have greater flexibility. The problem is usually a job for the programmer. ory over fairly long periods of com of deciding the optimal placement of The problem is that the mechanics of puter time. This is called clustering or programs in a fixed-size memory is defining separate program parts and locality of reference. Code loops and reduced. More programs can execute adding code to control data transfer manipulations of a data structure are concurrently because only the active between main and secondary mem examples of clusters or programs with portion of each occupies main mem ory are usually cumbersome tasks. good locality. A virtual system must ory. While this may induce less effi Also, the additional folding code detect and maintain in main memory cient use of the total addressable clouds program logic. Compilers and only the working set of a program, space, more effective use of the main linkers can simplify the task, but you memory is achieved. must still design the overlay frame Address space in a work. typical virtual system Having outlined the motivation for Despite these difficulties, however, ranges from 16 virtual storage, we are ready to ex folding operations are common. In plore basic components of system megabytes to 64 fact, the word processor I'm using to design. The memory-control process write this article applies the concept gigabytes, enough to must be transparent to normal opera twice. First, the program is too big to handle very ambitious tion and relatively efficient. On face fit completely into memory and is programming projects. value, you might doubt if reasonable divided into three overlays. Second, performance is possible, but research only a portion of my large text file into virtual-memory behavior clearly that is, those locations with high ac resides in memory at a given time demonstrates the concept's potential tivity. As activity gradually shifts to the rest is stored on disk. (see reference 2). I hope to show that other memory regions, these areas of As you can imagine, manual fold some practical systems can also have secondary storage are automatically ing consumes considerable time and a remarkably simple design. effort (as much as 25 to 40 percent of accessed and brought into main mem ory. As you might imagine, a high programming costs). But there is a Virtual-Memory Design: rate of secondary-storage access will way we can take advantage of the Basic Concepts benefits of large, sophisticated pro severely degrade performance. This is known as thrashing. Virtual storage systems require a grams without spending a tremen mixture of specialized hardware- and dous amount of time manually fold Benefits software-control policies. I will focus ing them to fit into small memory on architectural features that in spaces. Let's examine the benefits of virtual-memory management. Fore fluence virtual-memory operation. most, it removes the limit on program An understanding of intended ap Virtual Memory: Definition size imposed by main-memory size. plications should aid our analysis of Computer facilities that automati Address space in a typical virtual MMU products later. cally fold programs and data between address space system ranges from 16 megabytes to A computer's (AS) is two or more memory levels are called 64 gigabytes-large enough, I dare the legal range of addresses that can virtual-memory systems. Virtual say, to handle even the most am be generated by its instruction set. memory is a powerful concept. With bitious programming project! And The maximum size of this is deter it, you can consider main memory to virtual systems offer other advan mined by the number of bits in the be very large, mu.ch larger than its ac logical tages: processor's address register. A tual physical size. Intermediate files, address is a memory specification overlays, and many file-access proce • Main memory is allocated automat used by the central processor. Physi dures are no longer necessary. Pro- ically according to the demands made cal addresses, on the other hand, 212 April 1983 © BYTE Publications lnc LOGICAL ADDRESS MA IN PAGE OFFSET MEMORY 4 7 ADDRESS PAGE 0 I I I � MAP UN IT P6 I I 5 PHYSICAL + I ADDRESS 4 88 PAGING ASSOCIATIVE MAP TABLE 110 SECONDARY PHYSICAL- ;STORA GE PAGE ADDRESS u ID BASE WP EN ADDR ESS PAGE 0 � 6 I 0 I I '-to 4 0 I I I ' PI I I I ;EJ5 O I I I 6 I l 5 � PAGE 7 I FAULT 63 � t ITO MICROPROCESSORI Figure 1: The associative mapping scheme for virtual-memory systems. The central processing unit specifies a memory location with a two-part logical address that in cludes a page field and an offset field. The page field provides the value used for search ing the map table. All cells in the table are searched in parallel. If a match is fo und, the selected cell's physical-address-base field is added to the offset field.