SWE3015 Operating System Project Assignment 2 박은수, 박경원, 김지원

Slides:



Advertisements
Similar presentations
Incomplete Structs struct B; struct A { struct B * partner; // other declarations… }; struct B { struct A * partner; // other declarations… };
Advertisements

Memory Management in Linux Anand Sivasubramaniam.
CS 140 Project 3 Virtual Memory
Dynamic Memory Allocation (also see pointers lectures) -L. Grewe.
The Linux Kernel: Memory Management
Memory management.
CSE506: Operating Systems Physical Page Reclamation.
Shared Memory  Creating a Shared Memory Segment Allocated in byte amounts  Shared Memory Operations Create Attach Detach  Shared Memory Control Remove.
Shared memory. Process A Process B Physical Memory Virtual address space A Virtual address space B Share Instruction memory Data Instruction memory Data.
Linux ‘Demand-Paging’
Introduction to Memory Management 黃偉修 Linux Kernel.
Instructors: Randy Bryant and Dave O’Hallaron
Linux Memory Issues An introduction to some low-level and some high-level memory management concepts.
Linux Memory Management High-Level versus Low-Level.
Virtual Memory Topics Motivations for VM Address translation
P6/Linux Memory System Oct. 31, 2002
Memory System Case Studies Oct. 28, 2004 Topics P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping.
The ‘mmap()’ method Adding the ‘mmap()’ capability to our ‘vram.c’ device-driver.
Christo Wilson Project 3: Virtual Memory in Pintos
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
– 1 – P6 (PentiumPro,II,III,Celeron) memory system bus interface unit DRAM Memory bus instruction fetch unit L1 i-cache L2 cache cache bus L1 d-cache inst.
Memory Management in Linux David Chang OS Lab., NCTU,Taiwan.
Memory Mapping Sarah Diesburg COP5641.
Memory-Mapped Files & Unified VM System Vivek Pai.
Memory Mapped Files Using the Linux mechanism for direct access to device data.
1 Virtual Memory: Systems Level Andrew Case Slides adapted from jinyang Li, Randy Bryant and Dave O’Hallaron.
Linux Project 中央大學資工系 碩士二年級 江瑞敏. Outline How to compile linux kernel How to add a new system call Some Projects Example and Way to Solve it – System Call.
Linux Virtual Memory for Intel Processor
Memory System Case Studies Oct. 31, 2007 Topics P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping.
University of Amsterdam Computer Systems – virtual memory Arnoud Visser 1 Computer Systems Virtual Memory.
Processes and Virtual Memory
Sogang University Advanced Operating Systems (Process Management - Linux) Advanced Operating Systems (Process Management - Linux) Sang Gue Oh, Ph.D. .
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Implementation.
LINUX 15 : Memory Management
CS 105 “Tour of the Black Holes of Computing!”
1 Virtual Memory. 2 Outline Multilevel page tables Different points of view Pentium/Linux Memory System Memory Mapping Suggested reading: 10.6, 10.3,
What is a Process ? A program in execution.
1 Virtual Memory. 2 Outline Multilevel page tables Different points of view Pentium/Linux Memory System Memory Mapping Suggested reading: 10.6, 10.3,
Memory System Case Studies Mar. 20, 2008 Topics P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping.
Carnegie Mellon 1 Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Virtual Memory: Systems CENG331 - Computer Organization.
Why Kernel Works? kernel function gets dynamic memory in a fairly straightforward manner _get_free_pages( ) or alloc_pages( ) The simple approaches work.
Memory Management 백 일 우
Virtual Memory: Systems
CS 105 “Tour of the Black Holes of Computing!”
CS 105 “Tour of the Black Holes of Computing!”
Processes Chapter 3 These slides include text, figures, and information from Operating Systems Concepts, by Silberschatz, Galvin, and Gagne. They also.
Virtual Memory: Systems
Virtual Memory: Concepts CENG331 - Computer Organization
Virtual Memory: Systems /18-213/14-513/15-513: Introduction to Computer Systems 18th Lecture, October 25, 2018.
Virtual Memory: Systems
Virtual Memory: Systems
Making Virtual Memory Real: The Linux-x86-64 way
Memory System Case Studies Oct. 13, 2008
Pentium/Linux Memory System
P6 (PentiumPro,II,III,Celeron) memory system
CSC 660: Advanced Operating Systems
Pentium III / Linux Memory System April 4, 2000
Virtual Memory.
Instructor: Phil Gibbons
Virtual Memory: Systems CSCI 380: Operating Systems
CSE 451 Autumn 2003 November 13 Section.
CS 105 “Tour of the Black Holes of Computing!”
CS 105 “Tour of the Black Holes of Computing!”
Memory Management in Linux
User-level Memory Chris Gill, David Ferry, Brian Kocoloski
CS 105 “Tour of the Black Holes of Computing!”
Virtual Memory and Paging
MicroScope: Enabling Microarchitectural Replay Attacks
Paging Adapted from: © Ed Lazowska, Hank Levy, Andrea And Remzi Arpaci-Dussea, Michael Swift.
P6 (PentiumPro,II,III,Celeron) memory system
Presentation transcript:

SWE3015 Operating System Project Assignment 2 박은수, 박경원, 김지원 Demand Paging SWE3015 Operating System Project Assignment 2 박은수, 박경원, 김지원

Contents Concept Example Path

Demand Paging Concept http://csl.skku.edu/SWE3004S13/Overview When you need memory additionally, the demand paging allocates just VMA. And when you access them, it makes page-fault which allocates real physical memory. http://csl.skku.edu/SWE3004S13/Overview

Example: malloc() Example User level function for memory allocation only uses mmap() or brk() which don’t allocate physical memory but just virtual memory area. <※If the page which has been tried to access is not present, page fault handler allocates physical page : Demand paging>

Path do_page_fault(), __do_page_fault() handle_mm_fault(), __handle_mm_fault() handle_pte_fault() There are 5 functions to get the demand page in page-fault.

/linux-3.13/arch/x86/mm/fault.c do_page_fault(struct pt_regs *regs, unsigned long error_code) {} L.1253: __do_page_fault(regs, error_code); /linux-3.13/arch/x86/mm/fault.c

/linux-3.13/arch/x86/mm/fault.c unlikely(kmmio_fault(regs, address)) L.1058: unlikely(fault_in_kernel_space(address)) L.1084: unlikely(kprobes_fault(regs)) L.1090: static_cpu_has(X86_FEATURE_SMAP) L.1091: unlikely(smap_violation(error_code, regs)) L.1101: unlikely(in_atomic() || !mm) L.1143: unlikely(!down_read_trylock(&mm->mmap_sem)) L.1161: unlikely(!vma) L.1144: (error_code & PF_USER) == 0 && !search_exception_tables(regs->ip) L.1165: likely(vma->vm_start <= address) L.1167: unlikely(!(vma->vm_flags & VM_GROWSDOWN)) L.1171: error_code & PF_USER L.1193: unlikely(access_error(error_code, vma)) L.1178: unlikely(address + 65536 + 32 * sizeof(unsigned long) < regs->sp) L.1183: unlikely(expand_stack(vma, address)) L.1019: __do_page_fault(struct pt_regs *regs, unsigned long error_code) {} L.1203: handle_mm_fault(mm, vma, address, flags); False True /linux-3.13/arch/x86/mm/fault.c

__handle_mm_fault(mm, vma, address, flags); handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) {} L.3803: __handle_mm_fault(mm, vma, address, flags); /linux-3.13/mm/memory.c

/linux-3.13/mm/memory.c L.3692: unlikely(is_vm_hugetlb_page(vma)) L.3706: !pud L.3709: !pmd L.3711: pmd_none(*pmd) && transparent_hugepage_enabled(vma) L.3716: !(ret & VM_FAULT_FALLBACK) L.3723: pmd_trans_huge(orig_pmd) L.3766: unlikely(pmd_none(*pmd)) && unlikely(__pte_alloc(mm, vma, pmd, address)) L.3770: unliely(pmd_trans_huge(*pmd)) L.3692: __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) {} L.3778: handle_pte_fault(mm, vma, address, pte, pmd, flags); False True /linux-3.13/mm/memory.c

/linux-3.13/mm/memory.c (+ do_anonymous_page: allocate free page, !pte_present(entry) L.3633: handle_pte_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *pte, pmd_t *pmd, unsigned int flags) {} /* Demand Paging */ True /linux-3.13/mm/memory.c (+ do_anonymous_page: allocate free page, do_swap_page: swap in)

Q & A