Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary.

Slides:



Advertisements
Similar presentations
9.4 Page Replacement What if there is no free frame?
Advertisements

Chapter 10: Virtual Memory
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
CS 4284 Systems Capstone Godmar Back Virtual Memory – Paging Techniques.
Virtual Memory Management G. Anuradha Ref:- Galvin.
Virtual Memory. Hierarchy Cache Memory : Provide invisible speedup to main memory.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Structure of Processes
Memory Management Policies: UNIX
Introduction to Kernel
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Virtual Memory Program addresses only logical addresses, Hardware maps to physical addresses Possible to load only part of a process into memory –Possible.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual Memory.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Operating Systems ECE344 Ding Yuan Paging Lecture 8: Paging.
Virtual Memory 1 Chapter 13. Virtual Memory Introduction Demand Paging Hardware Requirements 4.3 BSD Virtual Memory 4.3 BSD Memory Management Operations.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 9: Virtual Memory.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Processes and Virtual Memory
Demand Paging Reference Reference on UNIX memory management
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Implementation.
LINUX 15 : Memory Management
Virtual Memory The address used by a programmer will be called a virtual address or logical address. An address in main memory is called a physical address.
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 9: Virtual-Memory Management 9.1 Background.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
Virtual Memory – Paging Techniques
Virtual Memory.
Topic 8 (Textbook - Chapter 9) Virtual Memory
Introduction to Kernel
SLC/VER1.0/OS CONCEPTS/OCT'99
CS 140 Lecture Notes: Virtual Memory
Lecture 11 Virtual Memory
Chapter 2: The Linux System Part 4
OPERATING SYSTEM CONCEPTS AND PRACTISE
Virtual Memory CSSE 332 Operating Systems
Chapter 9: Virtual Memory – Part I
Virtual Memory User memory model so far:
Chapter 9: Virtual Memory
Structure of Processes
Modeling Page Replacement Algorithms
Review.
Virtual Memory.
Structure of Processes
CS 140 Lecture Notes: Virtual Memory
Chapter 9: Virtual-Memory Management
Operating Systems Lecture November 2018.
Lecture 39 Syed Mansoor Sarwar
What Happens if There is no Free Frame?
CS 140 Lecture Notes: Virtual Memory
Modeling Page Replacement Algorithms
Chapter 6 Virtual Memory
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Lecture 37 Syed Mansoor Sarwar
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Lecture 7: Flexible Address Translation
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.
Structure of Processes
CSE 542: Operating Systems
Clock Algorithm Example
Module IV Memory Organization.
Presentation transcript:

Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary Memory (H.Disk) Virtual Memory Swap File

Region Virtual space of a process Stack, Data, Text – are regions of every process

Per Process Region Table - pregion For every region – Starting virtual address Number of pages in this region Access mode Pointer to the Page Table (page table for every region)

Page Table

Page Table Entry Demand paging fields Valid Reference Modify Copy on Write (COW) Age Modify, Reference -handle by the hardware

More tables Page frame data table (pfdata) One table Mapping all physical frames to disk Tells how many process are using this frame List of free frames Hash from disk address to frame Swap-use For every swap device Tells how many frames points to the same disk address

Using the Copy on Write in fork()

Kernel process for Virtual Memory Pager Every time the OS needs to swap a virtual page to the physical memory Get the first frame from the list of free pages, if the Modify bit is set write it’s data to the disk. Load the page to this frame Set the valid bit Resume the waiting process Page Stealer (page daemon) Every period of time Enter old frames to the list of free pages Update the age of every valid frame if the reference bit is 0 Put 0 in the the reference bit => LRU with second chance

Page Fault Some of the possibilities : 1. The page is in the swap file 2. The page is in the list of free pages FrameDisk Block Count Virt AddrPhysState Block 0K 1K1648invFile3 4KNoneinvFile5 64K1917invdisk K 66K1036invdisk847 67K Virt AddrPhysState Block 66K1776valdisk847 PageDisk Block Count After Swapping Page into Memory Page Table Entries Disk Block Page Frames

Event - Page Daemon done Event – Proc A reads from Pg2 Event – Proc A call to fork()

Event – Proc A reads from Pg1 Event – Proc B write to Pg6 Event – Page Daemon done

Event – Proc B reads from Pg2 & Pg5 Event – Page Daemon done Event – Proc A ends