Computer Science

Virtual Memory

Virtual memory is a memory management technique that allows a computer to use more memory than it physically has available. It does this by temporarily transferring data from the RAM to the hard disk. This allows programs to run as if they have more memory than is actually available.

Written by Perlego with AI-assistance

10 Key excerpts on "Virtual Memory"

  • Book cover image for: Introductory guide to operating systems
    • Jocelyn O. Padallan(Author)
    • 2023(Publication Date)
    • Arcler Press
      (Publisher)
    Figure 8.6. Computer hardware memory devices. Source: Image by Digitalworld839. Virtual Memory is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture’s various hardware memory devices (e.g., RAM, hard disk, CD-ROM) so that multiple processes (i.e., programs) can be executed independently in the same address space (i.e., with their own view of the virtual address space). Each separate process can be allocated its own quota of Virtual Memory by associating “pages” from the main system’s physical memory; thus, each process is given the impression that it is running on a machine with as much physical memory as it “sees” (which may actually be far less than what the entire physical machine has). Virtual Memory also allows for greater multitasking capacity since a program which would otherwise use up too Introductory Guide to Operating Systems 168 much physical memory can be assigned some other pages of Virtual Memory which are swapped in and out when need (Sjöstrand et al., 2015). During this swapping or “Virtual Memory,” some pages at the end of the program are saved to space on the hard drive temporarily while others are brought into those empty slots. This allows several programs to share resources and space in physical memory simultaneously; if they do not need access to those resources at exactly the same time, this swapping or “Virtual Memory” (Figure 8.7). Figure 8.7. The concept of address space. Source: https://www.researchgate.net/figure/An-example-of-a-process-virtual- address-space_fig1_344039145. This technique virtualizes the concept of the address space, allowing processes to use memory that they do not physically own, or requires no physical memory at all the address space is divided into pages and frames (page frame). When a program is launched, it may not be available in the main memory. It must be brought from external storage to an address space.
  • Book cover image for: First Course in Computer architecture, A
    ________________________ WORLD TECHNOLOGIES ________________________ Chapter 7 Virtual Memory and Microcode Virtual Memory The program thinks it has a large range of contiguous addresses, but in reality the parts it is currently using are scattered around RAM, and the inactive parts are saved in a disk file. In computing, Virtual Memory is a memory management technique developed for multi-tasking kernels. This technique virtualizes a computer architecture's various hardware memory devices (such as RAM modules and disk storage drives), allowing a program to be designed as though : ________________________ WORLD TECHNOLOGIES ________________________ • there is only one hardware memory device and this virtual device acts like a RAM module. • the program has, by default, sole access to this virtual RAM module as the basis for a contiguous working memory (an address space). Systems that employ Virtual Memory: • use hardware memory more efficiently than systems without Virtual Memory. • make the programming of applications easier by: o hiding fragmentation. o delegating to the kernel the burden of managing the memory hierarchy; there is no need for the program to handle overlays explicitly. o obviating the need to relocate program code or to access memory with relative addressing. Memory virtualization is a generalization of the concept of Virtual Memory. Virtual Memory is an integral part of a computer architecture; all implementations (exclu-ding emulators and virtual machines) require hardware support, typically in the form of a memory management unit built into the CPU. Consequently, older operating systems (such as DOS of the 1980s or those for the mainframes of the 1960s) generally have no Virtual Memory functionality, though notable exceptions include the Atlas, B5000, IBM System/360 Model 67, IBM System/370 mainframe systems of the early 1970s, and the Apple Lisa project circa 1980.
  • Book cover image for: Operating System Concepts
    • Abraham Silberschatz, Peter B. Galvin, Greg Gagne(Authors)
    • 2014(Publication Date)
    • Wiley
      (Publisher)
    Even in those cases where the entire program is needed, it may not all be needed at the same time. The ability to execute a program that is only partially in memory would confer many benefits: • A program would no longer be constrained by the amount of physical memory that is available. Users would be able to write programs for an extremely large virtual address space, simplifying the programming task. • Because each user program could take less physical memory, more pro- grams could be run at the same time, with a corresponding increase in CPU utilization and throughput but with no increase in response time or turnaround time. • Less I/O would be needed to load or swap user programs into memory, so each user program would run faster. Thus, running a program that is not entirely in memory would benefit both the system and the user. Virtual Memory involves the separation of logical memory as perceived by users from physical memory. This separation allows an extremely large Virtual Memory to be provided for programmers when only a smaller physical memory is available (Figure 9.1). Virtual Memory makes the task of programming much easier, because the programmer no longer needs to worry about the amount of physical memory available; she can concentrate instead on the problem to be programmed. The virtual address space of a process refers to the logical (or virtual) view of how a process is stored in memory. Typically, this view is that a process begins at a certain logical address—say, address 0—and exists in contiguous memory, as shown in Figure 9.2. Recall from Chapter 8, though, that in fact 9.1 Background 391 Virtual Memory memory map physical memory • • • page 0 page 1 page 2 page v Figure 9.1 Diagram showing Virtual Memory that is larger than physical memory. physical memory may be organized in page frames and that the physical page frames assigned to a process may not be contiguous.
  • Book cover image for: Encyclopedia of Computer Science and Technology
    eBook - ePub

    Encyclopedia of Computer Science and Technology

    Volume 14 - Very Large Data Base Systems to Zero-Memory and Markov Information Source

    • Jack Belzer, Albert G. Holzman, Allen Kent(Authors)
    • 2021(Publication Date)
    • CRC Press
      (Publisher)
    Virtual Memory SYSTEMS

    INTRODUCTION

    The main or primary memory of a computer system is the memory in which the instructions and data of a program must reside in order to be accessed by the processor. The maximum amount of main memory a processor is capable of addressing is referred to as its physical address space. A direct relationship exists between the cost of a system and the size of its physical address space. The larger it is, the greater the cost due to the increased number of bits and, thus, the increased amount of circuitry required for addressing. Because addresses, or components of addresses, are stored as part of instructions, larger address spaces can necessitate larger memory word sizes or result in multiple word instructions. It is a challenging problem to minimize the cost of the system and still provide a reasonable physical address space.
    Another truism related to memories is the faster the memory, the higher its cost. Systems have been designed having several different memories of varying size and speed, i.e., a memory hierarchy, since the earliest days of electronic computing. The minimal hierarchy consists of two levels, a relatively small amount of fast primary memory and a larger amount of slower secondary memory. Several different strategies have evolved which distribute instructions and data among the various memories in the hierarchy with the goal of keeping those instructions and data most likely to be referenced in the fastest memory.
    In recent years the term "Virtual Memory" has come to be associated with specific systems, those that are paged and/or segmented. Memory mappings of various sorts and for various reasons, however, are an integral part of most computer systems. Any system having an address mapping can be thought of as having Virtual Memory. Indeed, primitive address transformations are the basis from which paged and/or segmented Virtual Memory systems were developed.
  • Book cover image for: Operating System Concepts
    • Abraham Silberschatz, Peter B. Galvin, Greg Gagne(Authors)
    • 2018(Publication Date)
    • Wiley
      (Publisher)
    This separation allows an extremely large Virtual Memory to be provided for programmers when only a smaller physical memory is available (Figure 10.1). Virtual Memory makes the task of programming much easier, because the programmer no longer needs to worry about the amount of physical memory available; she can concentrate instead on programming the problem that is to be solved. The virtual address space of a process refers to the logical (or virtual) view of how a process is stored in memory. Typically, this view is that a process begins at a certain logical address—say, address 0—and exists in contiguous memory, as shown in Figure 10.2. Recall from Chapter 9, though, that in fact physical memory is organized in page frames and that the physical page frames assigned to a process may not be contiguous. It is up to the memory- 10.1 Background 391 Virtual Memory memory map physical memory backing store • • • page 0 page 1 page 2 page v Figure 10.1 Diagram showing Virtual Memory that is larger than physical memory. management unit (MMU) to map logical pages to physical page frames in memory. Note in Figure 10.2 that we allow the heap to grow upward in memory as it is used for dynamic memory allocation. Similarly, we allow for the stack to grow downward in memory through successive function calls. The large blank space (or hole) between the heap and the stack is part of the virtual address space but will require actual physical pages only if the heap or stack grows. Virtual address spaces that include holes are known as sparse address spaces. Using a sparse address space is beneficial because the holes can be filled as the stack or heap segments grow or if we wish to dynamically link libraries (or possibly other shared objects) during program execution. text 0 max data heap stack Figure 10.2 Virtual address space of a process in memory.
  • Book cover image for: Operating System Concepts Essentials
    • Abraham Silberschatz, Peter B. Galvin, Greg Gagne(Authors)
    • 2013(Publication Date)
    • Wiley
      (Publisher)
    An assembler symbol table may have room for 3,000 symbols, although the average program has less than 200 symbols. • Certain options and features of a program may be used rarely. For instance, the routines on U.S. government computers that balance the budget have not been used in many years. Even in those cases where the entire program is needed, it may not all be needed at the same time. The ability to execute a program that is only partially in memory would confer many benefits: • A program would no longer be constrained by the amount of physical memory that is available. Users would be able to write programs for an extremely large virtual address space, simplifying the programming task. • Because each user program could take less physical memory, more programs could be run at the same time, with a corresponding increase in CPU utilization and throughput but with no increase in response time or turnaround time. • Less I/O would be needed to load or swap user programs into memory, so each user program would run faster. Thus, running a program that is not entirely in memory would benefit both the system and the user. Virtual Memory involves the separation of logical memory as perceived by users from physical memory. This separation allows an extremely large Virtual Memory to be provided for programmers when only a smaller physical memory is available (Figure 8.1). Virtual Memory makes the task of program- ming much easier, because the programmer no longer needs to worry about the amount of physical memory available; she can concentrate instead on the problem to be programmed. The virtual address space of a process refers to the logical (or virtual) view of how a process is stored in memory. Typically, this view is that a process begins at a certain logical address—say, address 0—and exists in contiguous memory, as shown in Figure 8.2. Recall from Chapter 7, though, that in fact
  • Book cover image for: Architectural and Operating System Support for Virtual Memory
    • Abhishek Bhattacharjee, Daniel Lustig(Authors)
    • 2022(Publication Date)
    • Springer
      (Publisher)
    5 C H A P T E R 2 The Virtual Memory Abstraction Before we dive into the implementation of the VM subsystem later in the book, we describe the VM abstraction that it provides to each process. This lays out the goal for the implementation details that will be described in the rest of this book. It also serves as a refresher for readers who might want to review the basics before diving into more advanced topics. 2.1 ANATOMY OF A TYPICAL VIRTUAL ADDRESS SPACE We start by reminding readers of the important distinction between “memory” and “address space,” even though the two are often used interchangeably in informal discussions. The former refers to a data storage medium, while the latter is a set of memory addresses. Not every memory address actually refers to memory; some portions of the address space may contain addresses that have not (yet) actually been allocated memory, while others might be explicitly reserved for mechanisms such as memory-mapped input/output (MMIO), which provides access to external devices and other non-memory resources through a memory interface. Where appropriate, we will be careful to make this distinction as well. A wide variety of memory regions are mapped in the address space of any general process. Besides the heap and stack, the memory space of a typical process also includes the program code, the contents of any dynamically linked libraries, the operating system data structures, and various other assorted memory regions. The VM subsystem is responsible for supporting the various needs of all of these regions, not just for the heap and the stack. Furthermore, many of these other regions have special characteristics (such as restricted access permissions) that impose specific requirements onto the VM subsystem. The details of how a program’s higher-level notion of “memory” is mapped onto the hard- ware’s notion of VM is specific to each operating system and application binary interface (ABI).
  • Book cover image for: Understanding Operating Systems
    • Ann McHoes, , Ida M. Flynn, , Ann McHoes, Ida M. Flynn(Authors)
    • 2017(Publication Date)
    segmented memory allocation: a memory allocation scheme based on the concept of dividing a user’s job into logical groupings of code in order to allow for noncontiguous program storage during execution. subroutine: also called a “subprogram,” a segment of a program that can perform a specific function. Subroutines can reduce programming time when a specific function is required at more than one point in a program. thrashing: a phenomenon in a Virtual Memory system where an excessive amount of page swapping back and forth between main memory and secondary storage results in higher overhead and little useful work. Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-300 96 Chapter 3 | Memory Management Includes Virtual Memory Virtual Memory: a technique that allows programs to be executed even though they are not stored entirely in memory. working set: a collection of pages to be kept in main memory for each active process in a Virtual Memory environment. To Explore More For additional background on a few of the topics discussed in this chapter, begin a search with these terms. • Virtual Memory Principles • Thrashing Avoidance • Cache Memory Management • Working Set • Peter Denning Exercises Research Topics A. New research on topics concerning operating systems and computer science are published frequently by professional societies; and academic libraries offer access to many of these journals. Research the Internet or current literature to identify at least two prominent professional societies with peer-reviewed computer science journals, then list the advantages of becoming a member and the dues for students. Also provide a one-sentence summary of a published paper concerning operating systems. Cite your sources. B. Research the maximum amount of Virtual Memory that can be accom-modated on at least three different computing devices.
  • Book cover image for: Operating Systems In Depth
    eBook - PDF

    Operating Systems In Depth

    Design and Programming

    • Thomas W. Doeppner(Author)
    • 2011(Publication Date)
    • Wiley
      (Publisher)
    What on a virtual machine is considered to 4 See http://www.intel.com/design/itanium/arch_spec.htm for technical documentation. 7.2 Hardware Support for Virtual Memory 299 300 CHAPTER 7 Memory Management be virtual and real memory might more accurately be called, from the real machine’s perspective, virtual Virtual Memory and virtual real memory. Thus an operating system running on a virtual machine arranges for the translation of virtual virtual addresses to virtual real addresses. Since virtual real addresses are virtual as far as the real machine is concerned, the virtual machine monitor (VMM) must somehow arrange to translate them into real addresses. 5 In an architecture with page tables, the operating system on the virtual machine sets up page tables to do the virtual-virtual to virtual-real mapping. The VMM has set up page tables to do the virtual real to real mapping. When the virtual machine is running, what we really want is the composition of the mappings done by the two sets of page tables — a mapping from virtual virtual to real. One way of doing this is the shadow page-table approach. The VMM maintains for each virtual machine a set of page tables (the shadow page tables) that actually is the composition of the virtual-virtual to virtual-real translation and virtual to real translation. Thus the operating system on the virtual machine maintains a set of page tables mapping what it considers Virtual Memory to what it considers real memory. Whenever it establishes or modifies such a set, the VMM is notified and makes the appropriate changes in the shadow page tables (Figure 7.16). When the real processor is running a program that is expecting the virtual virtual address space, it uses the shadow page table. Though laborious, shadow page tables are required if the operating system on the virtual machine is to behave as if it were running on a real machine.
  • Book cover image for: Access Control, Security, and Trust
    eBook - PDF
    Chapter 10 Virtual Machines and Memory Protection Controlling access to memory is critical for sharing one machine among many users and processes. Security is impossible without the capabilities to isolate one process from another and to control how data are shared. For example, if Alice and Bob are running their programs on the same machine, their programs should be protected from one another. Such protection requires that Alice’s calculations should not spill over into the memory used by Bob. Furthermore, unless Alice has authorization from Bob or other appropriate controlling authorities, Alice should not be able to read from or write to Bob’s data stored in memory. Many of the basic concepts of memory protection—including Virtual Memory and access control—were worked out in the era of time-shared mainframe computers. These mainframes were viewed as centralized resources to be shared among many users simultaneously. With the introduction of minicomputers and microprocessors— which later evolved into personal computers—many memory-protection mechanisms were discarded for efficiency reasons, under the assumption that personal computers were ultimately controlled by single users and not shared. Widespread network-ing has since falsified this assumption, making memory-protection mechanisms and virtual-machine technologies relevant once again. A virtual machine (VM) is a simulation of a physical machine. This simulation provides the illusion to operating systems and programs that they are running di-rectly on the hardware. Protecting the real machine, processes, and one user from another is the task of the virtual machine monitor (VMM), which is a layer (often implemented in microcode or software) separating virtual machines and hardware. Figure 10.1 illustrates this idea, showing three operating systems supported by a VMM that operates on a single hardware platform.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.