X86 (32-bit) Paging Reference –text: Tanenbaum ch.4.3 Reference on Win2K memory management –text: Tanenbaum ch. 11.5.3.

Slides:



Advertisements
Similar presentations
Memory Management: Overlays and Virtual Memory
Advertisements

Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
Configuring the Operating System Configure Performance Options Processor scheduling and memory usage Virtual memory Memory for network performance Configure.
CS 153 Design of Operating Systems Spring 2015
03/26/2010CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying an earlier.
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
Memory Management (II)
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Virtual Memory Main Memory Magnetic Disk Upper level Lower level.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Address Translation Mechanism of 80386
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Operating Systems ECE344 Ding Yuan Paging Lecture 8: Paging.
1 Virtual Memory. 2 Outline Pentium/Linux Memory System Core i7 Suggested reading: 9.6, 9.7.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Fundamentals of Programming Languages-II Subject Code: Teaching SchemeExamination Scheme Theory: 1 Hr./WeekOnline Examination: 50 Marks Practical:
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
Pentium III Memory.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
Paging (continued) & Caching CS-3013 A-term Paging (continued) & Caching CS-3013 Operating Systems A-term 2008 (Slides include materials from Modern.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Demand Paging Reference Reference on UNIX memory management
Memory Management: Overlays and Virtual Memory. Agenda Overview of Virtual Memory –Review material based on Computer Architecture and OS concepts Credits.
Lab4: Virtual Memory CS 3410 : Computer System Organization & Programming Spring 2015.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
Lecture 14 PA2. Lab 2: Demand Paging Implement the following syscalls xmmap, xmunmap, vcreate, vgetmem/vfreemem, srpolicy Deadline: November , 10:00.
Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts.
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
Chapter 9 Memory Organization. 9.1 Hierarchical Memory Systems Figure 9.1.
1 Virtual Memory. 2 Outline Case analysis –Pentium/Linux Memory System –Core i7 Suggested reading: 9.7.
Computer Architecture Lecture 12: Virtual Memory I
Translation Lookaside Buffer
MODERN OPERATING SYSTEMS Third Edition ANDREW S
SLC/VER1.0/OS CONCEPTS/OCT'99
CS 140 Lecture Notes: Virtual Memory
Virtual Memory CSSE 332 Operating Systems
Section 9: Virtual Memory (VM)
Paging COMP 755.
Modeling Page Replacement Algorithms
Address Translation Mechanism of 80386
Demand Paging Reference Reference on UNIX memory management
Memory Management References text: Tanenbaum ch.4.
x86 segmentation, page tables, and interrupts
CSE 153 Design of Operating Systems Winter 2018
Demand Paging Reference Reference on UNIX memory management
CSE 153 Design of Operating Systems Winter 2018
Lecture 28: Virtual Memory-Address Translation
CS 140 Lecture Notes: Virtual Memory
Memory Management References text: Tanenbaum ch.4.
Module IV Memory Organization.
CS 140 Lecture Notes: Virtual Memory
Modeling Page Replacement Algorithms
Introduction to the Intel x86’s support for “virtual” memory
Translation Lookaside Buffer
Virtual Memory Overcoming main memory size limitation
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2004 Page Tables, TLBs, and Other Pragmatics Hank Levy 1.
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 153 Design of Operating Systems Winter 2019
Paging and Segmentation
CSE 451: Operating Systems Winter 2005 Page Tables, TLBs, and Other Pragmatics Steve Gribble 1.
CSE 153 Design of Operating Systems Winter 2019
CS 140 Lecture Notes: Virtual Memory
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
CS444/544 Operating Systems II Virtual Memory
Virtual Memory 1 1.
Presentation transcript:

x86 (32-bit) Paging Reference –text: Tanenbaum ch.4.3 Reference on Win2K memory management –text: Tanenbaum ch

x86 Multilevel Paging Page table #0 Page table #1 Page table # Page Table Directory Page Which page table? Which page? What offset? 32-bit virtual address 10 bits 12 bits Page #0 Page #1 Page #1023 Page Table 12 bits 20 bits 32-bit physical address

x86 Page Table Entry Important bits –V: bit =1, valid page table entry –W: bit=1, writing to page permitted –U: bit =1, page is accessible in user mode –A: bit =1, page has been accessed –D: bit =1, page is dirty(has been modified) VWU Wt CADLGNot usedPage frame Bit

SAPC Memory Management Paging is turned on 4M(0x3f ffff) byte memory fits into 1 page table 1 Page Table(PT) at virtual address 0x52000 (in the Tutor area) has –1024 Page Table Entries(PTE) which point to 1024 pages Each page has 4096 memory locations Total address 1x1024x4096= 4M

SAPC Memory Management (cont’d) Tutor> mdd PTE0 PTE1 PTE2 PTE3 Page Table –Page 0 -> Page frame 0 –Page 1 -> Page frame 1 –and so on Important Bits for PTE0 –D=0; A=0; U=1; W=1; V =1 Page frame number Important bits Identity paging: VA = PA for every address 0 to 0x 3f ffff. Paging is turned on, memory is being used as if paging is not on.

Important Bits For PTE0 D=0 :page 0 has not been modified A=0 : page 0 has not been accessed U=1 :page 0 is accessed in user mode W=1:page 0 permits writes to the page V =1:page 0 is valid See the bits in motion Tutor> md > PTE0: A=1 Tutor> ms a > PTE0: A=1, D=1 Memory display in bytes

Experiment with Paging Currently we have identity paging page 0 -> page frame 0 page 1 -> page frame 1 and so on We can modify the page table to: page 0 -> page frame 2 by changing PTE0 page 1 -> page frame 1 page 2 -> page frame 6 by changing PTE2 Modify using Tutor Tutor> ms Tutor> ms Tutor>mdd Memory display in double words

Instruction Example mov %eax, 0 Operand address 0 is a VA Use the last page table, page 0 -> page frame 2 MMU will map VA 0 into physical address 0x2000

Page Faults Refer to the virtual address -> physical address mapping example: What happens to page 6? Access to page 6 (address 0x6000-6fff) will cause a page fault Page fault is a trap to OS and the OS decides what to do May access the disk to read the executable file for another page of code. Fill in the page table and set the page’s V bit =1. This causes the CPU to re-execute the instruction. This time will be successful because V bit=1.

Page Fault Handling Most instruction execution does not cause page faults and does not involve the OS The OS gets involved only occasionally when a new page is referenced for the first time. A program image starts out with only a few pages of memory and page faults notify the OS of the needs of additional program. The strategy that pages are loaded only on demand, not in advance, is called demand paging.

Multiple Page Tables The SAPC only uses one page table handling 4M of VA space A real 32-bit system addresses 4G of memory space. It takes 1024 page tables grouped together in a page directory(PD). The physical address of PD is stored in CPU’s CR3 register. The Page Directory Entries(PDE) have the same format as the Page Table Entries(PTE) except that the D bit is not in use

Page Directory Need overhead memory 1024 x 32 bits (for PDEs) x 1024 x 32 bits (for PTEs) = 1025x 4K=4M bytes for a 4G program For a small program(~ 3PTs: 1 PT for code +data, 1 PT for stack, 1PT for C Library and DLLs), too much overhead Small program uses the V-bit in PDE to mark only those PTs that are in use It uses 3 PTs and 1PD (1024 x 3 x x 32 bits) ~16K bytes

Virtual Address -> Physical Address Example VA = 0x = MMU would access PDE 0x48 to find the location of PT. MMU would access PTE 0x345 to find the physical page. Put together the physical page number and offset to form the physical address PDE = 0x48PTE = 0x345offset = 0x678