Download presentation
Presentation is loading. Please wait.
Published byArron Goodwin Modified over 9 years ago
1
Operating Systems Unit 7: – Virtual Memory organization Operating Systems
2
COP 5994 - Operating Systems2 Evolution of memory organization
3
COP 5994 - Operating Systems3 Virtual Memory concept Solves problem of limited memory space –Creates illusion of more memory than exists Creates 2 types of addresses Virtual addresses –Referenced by processes Physical addresses –Describes locations in main memory Memory management unit (MMU) Dynamic address translation Translates virtual addresses to physical address
4
COP 5994 - Operating Systems4 Two-level Storage backing store: –maintained on hard drive –contains complete virtual memory real memory: –portion of virtual memory that is currently in use Process can only access real memory –Management of mapping is essential
5
COP 5994 - Operating Systems5 Two-level Storage
6
COP 5994 - Operating Systems6 Address Translation Mapping virtual addresses to real addresses need address translation map per process Address translation maps –Indicate which regions of a process’s virtual address space are currently in main memory and where they are located
7
COP 5994 - Operating Systems7 Mapping based on block
8
COP 5994 - Operating Systems8 address translation map is table with –block number –actual location of block in memory typical implementation –block number is offset from table origin –table entries contain block location in memory Concept: block map table
9
COP 5994 - Operating Systems9 structure of virtual address: b is the block number in virtual memory d is the displacement from the start of block b at which the referenced item is located Concept: virtual address
10
COP 5994 - Operating Systems10 Block Mapping Process
11
COP 5994 - Operating Systems11 Blocks ? Pages –Blocks are fixed size –Technique is called paging Segments –Blocks maybe of different size –Technique is called segmentation
12
COP 5994 - Operating Systems12 Paging Paging uses fixed-size block mapping: –Virtual address in paging system: v = (p, d) p is the number of the page in virtual memory on which the referenced item resides d is the displacement from the start of page p at which the referenced item is located
13
COP 5994 - Operating Systems13 Page Frame: page in real memory Fixed-size block of main memory Aligned with page size multiple
14
COP 5994 - Operating Systems14 Page to Frame correspondence
15
COP 5994 - Operating Systems15 Page Table Entry (PTE) maps virtual page p to page frame p´ –Contains bit to indicate if page is in real memory –Term: Page Fault access to memory location on page that is not in real memory
16
COP 5994 - Operating Systems16 Page Address Translation Direct Mapping Associative Memory Translation Lookaside Buffer Concerns: –memory access speed –size of page table
17
COP 5994 - Operating Systems17 Address Translation by Direct Mapping
18
COP 5994 - Operating Systems18 Page Table size address size: 4 bytes bytes virtual memory amount: 4GB Page size: 4k pages in virtual memory PTE size: 8 bytes bytes maximum page table size: 8MB Page table will not fit into processor cache
19
COP 5994 - Operating Systems19 Page Table size address size: 8 bytes bytes virtual memory amount Page size: 4k pages in virtual memory PTE size: 16 bytes bytes maximum page table size Page table will not fit into processor cache
20
COP 5994 - Operating Systems20 Address Translation by Associative Mapping
21
COP 5994 - Operating Systems21 Combination: Direct/Associative Mapping Experience shows: TLB size of 64 or 128 Can reach 90% of associative mapping performance
22
COP 5994 - Operating Systems22 Page Address Translation: concerns memory access speed –consider cache speed size of page table –32 bit vs. 64 bit use of memory space –locality of memory references –sparseness advanced approaches –multi-level page tables –inverted page table
23
COP 5994 - Operating Systems23 Multilevel Page Tables Hierarchy of page tables –Each level containing a table that stores pointers to tables in the level below –Bottom-most level comprised of tables containing address translations Can reduce memory overhead compared to direct-mapping system –page table does not have to be contiguous
24
COP 5994 - Operating Systems24 Multilevel Page Tables
25
COP 5994 - Operating Systems25 Inverted Page Tables –One inverted page table stores one PTE in memory for each page frame in the system –Inverted relative to traditional page tables –Uses hash functions to map virtual page to inverted page table entry
26
COP 5994 - Operating Systems26 Inverted Page Tables
27
COP 5994 - Operating Systems27 Inverted Page Tables Hash collisions increase memory accesses Collisions can be reduced by increasing the range of the hash function –Cannot increase the size of the inverted page table because it must store exactly one PTE for each page frame trick: hash anchor table – one more level of indirection
28
COP 5994 - Operating Systems28 Inverted Page Tables with hash anchor table
29
COP 5994 - Operating Systems29 Also: Page Sharing programs may share common pages –data and/or instructions pages marked as sharable or nonsharable
30
COP 5994 - Operating Systems30 Segmentation based on variable-size segments –contiguous block of process’ address space data, text, stack process can run if current segment(s) is in main memory
31
COP 5994 - Operating Systems31 Segmentation
32
COP 5994 - Operating Systems32 Segmentation virtual memory address v = (s, d) –s is the segment number in virtual memory –d is the displacement within segment s at which the referenced item is located
33
COP 5994 - Operating Systems33 Address Translation by Direct Mapping
34
COP 5994 - Operating Systems34 Segment map table entry maps segment s to real memory address s´ –has resident bit to indicate segment is in memory If so, it stores the segment base address Otherwise, it stores the location of the segment on secondary storage –has segment length field useful to protect memory outside of segment
35
COP 5994 - Operating Systems35 Segment map table entry
36
COP 5994 - Operating Systems36 Segment map table entry: protection
37
COP 5994 - Operating Systems37 Also: Segment Sharing Caution: segment protection
38
COP 5994 - Operating Systems38 Combination: Segmentation/Paging Systems Segments occupy one or more pages All pages of segment need not be in main memory at once Pages contiguous in virtual memory need not be contiguous in main memory
39
COP 5994 - Operating Systems39 –s is segment number –p is page number within segment –d is displacement within page at which desired item located Virtual memory address
40
COP 5994 - Operating Systems40 Address Translation
41
COP 5994 - Operating Systems41 System-wide Table Structure
42
COP 5994 - Operating Systems42 Sharing and Protection Page replacement requires updates to several tables Protection checking is complex
43
COP 5994 - Operating Systems43 Agenda for next week: next week: –Chapter 11: Virtual Memory Management –Read ahead !
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.