Download presentation
Presentation is loading. Please wait.
Published byPaula Walker Modified over 9 years ago
1
Virtual Memory By Steven LaBarbera
2
What I plan to cover The history of virtual memory How virtual memory has evolved How virtual memory is used today Why is virtual memory important
3
History of virtual memory Early computers used a two-level storage system consisting of main memory and secondary memory. main memory (RAM) for the first computers were magnetic cores. The secondary memory (hard disks) were magnetic drums.
4
History of virtual memory Early in computers infancy memory was neither inexpensive nor easy to find. the most sophisticated computers were lucky to have 128 kilobytes of memory, a fraction of what a floppy disk can hold. This lack of space had serious implications on older systems processing power.
5
Why did lack of space have serious implications? Programmers had to re-code their program every time they switched machines or added more memory.
6
How did they deal with this? programmers divided programs into sections that were transferred into main memory for a period of processing time. As the program proceeded, new sections moved into main memory and replaced sections that were not needed. In this early era of computing, the programmer was responsible for devising this overlay system. overlay system
7
The creation of virtual memory The technique was invented at the University of Manchester for the Atlas Computer, completed in 1962.University of ManchesterAtlas Computer1962
8
How virtual memory works when a memory location is read or written to hardware within the computer translates the memory address generated by the software (the virtual memory address) into a, usually distinct, real memory addresshardware
9
Continued This is accomplished by preserving the low order bits of the binary representation of the input address while treating the high order bits as a key to one or more address translation tables. a range of consecutive addresses in the virtual address space whose size is a power of two will be translated in a corresponding range of consecutive physical addresses.power of two
10
Simple Paging The memory referenced by such a range is called a page In a simple paging system you view the users program as consisting of fixed length blocks The page size is typically in the range of 512 to 8192 bytes
11
Simple Paging In a paging system consider the addresses as consisting of two components. 1.The page number 2.The displacement into the page Page 0 0FFF Page 1 1FFF Page 2 2FFF Page 3 3FFF
12
The displacement component This must be big enough to hold any displacement within a page. Example 2^12 – byte (4k) page size, the displacement of this has to hold 2^12 – 1. Thus a 2^12 displacement requires a 12 bit (3 hex digit) displacement field 2^n page requires n-bit displacement field
13
Translation from virtual memory to physical memory Translations are managed by the Memory Management Unit (MMU).
14
Translation from virtual memory to physical memory ( 1 ) or "logical address" consisting of a logical page number plus the location within that page (x) must be interpreted or "mapped" onto an actual (physical) main memory address by the operating system using an address translation function or mappermapper
15
Translation from virtual memory to physical memory ( 2 ) If the page is present in the main memory, the mapper substitutes the physical page frame number for the logical number
16
Translation from virtual memory to physical memory ( 3 ) If the mapper detects that the page requested is not present in main memory, a fault occurs and the page must be read into a frame in main memory from secondary storage ( 4, 5 ).
17
What does the mapper do? translates the logical page number generated by the program into the physical page frame number where the main memory holds the pagelogical page number
18
What does the mapper do? This translation is accomplished by using a directly indexed table called the page table which identifies the location of all the program's pages in the main store page table
19
Page Table As the operating system loads pages of a user program into memory, it uses a page table to keep track of the location of each page. A page table is a one-dimensional array in main memory that contains a slot for every page in the users program.
20
Page Table the page table shows that pages 0,1,2, and 3 are in frames 4,6,2,and 5 Page Number 01230123 Frame Number 4 6 2 5
21
DAT Unit In the book the DAT Unit is used to translate virtual addresses to physical addresses. Dynamic Address Translation Unit
22
Paging pros and cons Pros Eliminates memory fragmentation problems seen in multiprogramming systems. Paging systems do not have compaction overhead that systems with relocation have. Cons Has to do two operations every time CPU fetches an item from memory. 1.Obtain page number from page table. 2.Obtain desired item from main memory at the computed physical address.
23
How they fix this inefficiency Carefully designing the DAT Unit. Every time CPU fetches an item from memory you keep a copy of the page table in a local memory area of the DAT Unit. So every time a DAT Unit translates an address from the program, it can get the framer number from local memory.
24
Demand Paging Each page table contains two parts 1.The frame number 2.A valid bit
25
Valid bit field The valid bit indicates if the corresponding page is in memory. 0 = not in memory 1= in memory
26
Why is Virtual Memory Important? The advantage of virtual memory is that it allows a computer to multiplex its CPU and memory between multiple programs without the need to perform expensive copying of the programs' memory images. If the combination of virtual memory system and operating system supports swapping, then the computer may be able to run simultaneously programs whose total size exceeds the available physical memory.
27
Review when a memory location is read or written to hardware within the computer translates the memory address generated by the software (the virtual memory address) into a, usually distinct, real memory address hardware
28
Review MMU or Memory Management Unit DAT Unit or Dynamic Address Translation Unit These are the techniques used to translate a virtual address to a physical address.
29
Review Simple Paging Fixed length blocks Holds page number Displacement field Demand Paging Holds frame number Boolean valid bit 1 = in memory 0= not in memory
30
References Virtual Memory Tutorial http://cne.gmu.edu/itcore/virtualmemory/vm history.html http://cne.gmu.edu/itcore/virtualmemory/vm history.html Virtual Memory Modulehttp://cne.gmu.edu/modules/vm/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.