270 likes | 345 Views
The UVM Virtual Memory System. Charles D. Cranor & Gurudatta M. Parulkar. Presented by: Dulan Wathugala 10/07/2004. Who’s who. Charles D. Cranor (Chuck) Senior Technical Staff Member AT&T Labs-Research http://www.netbsd.org/~chuck/. Gurudatta M. Parulkar
E N D
The UVM Virtual Memory System Charles D. Cranor & Gurudatta M. Parulkar Presented by: Dulan Wathugala 10/07/2004
Who’s who Charles D. Cranor (Chuck) Senior Technical Staff Member AT&T Labs-Research http://www.netbsd.org/~chuck/ Gurudatta M. Parulkar Former Professor of Computer Science Washington University in St. Louis http://www.arl.wustl.edu/~guru/
Outline • Tasks of VM. • VM layering. • Data structures used. • Memory Objects. • Page Clustering. • Overall Performance.
Tasks of VM System • Allocate PM to processes. • Deallocate unused memory. • Keep track of who accesses which memory. • Memory protection. • Swap space management.
VM Overview • Small machine dependent layer (pmap) • Programming processor’s MMU • Adding, removing, modifying, and querying the mappings of virtual addresses or of a page of physical memory. • Has no knowledge about higher-level OS abstractions such as files.
VM Overview • Large machine-independent layer. • Shared by all BSD supported processes. • Perform high-level operations of VM system. • Mapping a process’ file mappings. • Requesting data from backing store. • Paging out memory as needed. • Managing copy-on-write memory.
Data StructuresMachine-Independent Layer vmspace memory map pmap map entry stack text bss data Memory Object (Triangle) Page (black circle) zero-fill /sbin/init zero-fill pager pager pager vnode swap swap
Caching Conflicts Only 100 objects Last Access time Vnode 4 Vnode 1 object cache 3 Vnode 2 7 Vnode 3 vnode cache
Caching Conflicts – UVM Solution Only 100 objects Last Access time Vnode 4 Vnode 1 object cache 3 Vnode 2 7 Vnode 3 vnode cache
BSD: Copy-on-write: Write faults Initial mapping Write-fault map entry map entry needs- copy needs- copy shadow 1 ./orig_file ./orig_file
Parent me shadow 1 ./orig_file BSD: Copy-on-write: Fork Fork Write fault Child me map entry needs- copy needs- copy shadow 1 ./orig_file
BSD: Write Faults After Fork Parent writes to middle page Child writes to right hand page Parent me Child me Parent me Child me needs- copy needs- copy needs- copy shadow 2 shadow 2 shadow 3 shadow 1 shadow 1 ./orig_file ./orig_file
UVM: Copy-on-write: Write faults Initial mapping Write-fault needs- copy map entry amap/obj needs- copy map entry amap/obj amap 1 1 anon 1 ./orig_file ./orig_file
2 UVM: Copy-on-write: Fork Write fault Fork needs- copy Parent me amap/obj needs- copy Child me amap/obj map entry amap/obj amap 1 amap 1 1 1 anon 1 anon 1 ./orig_file ./orig_file
1 UVM: Write Faults After Fork Parent writes to middle page needs- copy Parent me amap/obj needs- copy Child me amap/obj amap 2 1 anon 2 amap 1 2 ./orig_file anon 1
UVM: Write Faults After Fork Child writes to right hand page Parent me amap/obj needs- copy Child me amap/obj amap 2 anon 2 1 amap 1 1 1 ./orig_file anon 1 anon 3
BSD Vs UVM BSD UVM Parent me Child me Parent me amap/obj Child me amap/obj amap 2 shadow 2 shadow 3 anon 2 1 shadow 1 amap 1 1 1 ./orig_file ./orig_file anon 1 anon 3
Page Clustering - Effect Amount of physical memory 32 MB
Overall UVM Performance Reference: C. Cranor. Design and Implementation of the UVM Virtual Memory System. Doctoral dissertation, Washington University, August 1998.
Current Status of UVM • “Implemented in the NetBSD operating system, UVM completely replaces the Mach based 4.4BSD VM system.” [1]
UVM • Has designed efficient data structures. • Has eliminated redundancies. • Delegated work to other kernel subsystems. • Made the VM system more correlated with the OS.
References • http://ccrc.wustl.edu/pub/chuck/tech/uvm • C. Cranor. Design and Implementation of the UVM Virtual Memory System. Doctoral dissertation, Washington University, August 1998.
Chuk’s Full Thesis • The full thesis can be downloaded at http://citeseer.ist.psu.edu/cranor98design.html or http://ccrc.wustl.edu/pub/chuck/tech/uvm/