1 / 28

Virtual Memory Primitives for User Programs

Virtual Memory Primitives for User Programs. Andrew W. Appel and Kai Li. Presented by Phil Howard. Virtual Memory . A brief history Programmer Control Compiler Control System Control New Applications Concurrent Garbage Collection Shared Virtual Memory Concurrent Checkpointing

Download Presentation

Virtual Memory Primitives for User Programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Virtual Memory Primitives for User Programs Andrew W. Appel and Kai Li Presented by Phil Howard

  2. Virtual Memory • A brief history • Programmer Control • Compiler Control • System Control • New Applications • Concurrent Garbage Collection • Shared Virtual Memory • Concurrent Checkpointing • Persistent Heap • Extending Addressing • Data Compression Paging • Conclusions

  3. Programmer Controlled Memory 16 bit address space 17 bit program size

  4. Programmer Controlled Memory bar() { } foo() { } main() { foo(); bar(); }

  5. Compiler Controlled Memory 20 bit physical memory 16 bit address space

  6. Program Segment Program Counter Compiler Controlled Memory

  7. Compiler Controlled Memory • Call: • push PC • load PC with effective address • Return: • pop PC

  8. Compiler Controlled Memory • Call: • push PC • push PS • load PS,PC with effective address • push DS • Return: • pop DS • pop PS,PC

  9. System Controlled Memory 32 bit address space 1M physical memory

  10. System Controlled Memory Physical Address Virtual Address CPU MMU RAM

  11. System Controlled Memory • System handles page faults • Allowed protection • You can't see my pages • You can't change my pages • I can't execute my data • I can't change my program • Made life much easier for programmers

  12. But wait… Appel and Li want to control memory themselves Why?

  13. User access to VM primitives • TRAP - Handle page fault • PROT1 - Protect a single page • PROTN - Protect many pages • UNPROT - Unprotect single page • DIRTY - return list of dirty pages • MAP2 - Map a page to two addresses

  14. Concurrent Garbage Collection Heap From To root

  15. Concurrent Garbage Collection Heap From To root root

  16. Concurrent Garbage Collection Invariants • Mutator sees only to-space pointers • New objects contain to-space pointers only • Objects in to-space contain to-space pointers only • Objects in from-space contain from-space and to-space pointers

  17. Concurrent Garbage Collection • Use VM to protect from-space • Collector handles access violations, validates objects and updates pointers • Collector uses aliased addresses to scan in background

  18. Shared Virtual Memory CPU CPU CPU Memory Memory Memory Mapping Manager Mapping Manager Mapping Manager Shared Virtual Memory

  19. Shared Virtual Memory • Coherent across processors - each read gets the last value written • Multiple readers/Single writer • Handled the same as "regular" VM except for fetching and writing pages

  20. Stop all threads Save all thread states Save all memory Restart threads Stop all threads Save all thread states Make all memory read-only Restart threads Save pages in the "background" and mark as read/write Concurrent Checkpointing

  21. Persistent Heap • Heap survives across process invocations • Read/Write access as fast as conventional heap • Use memory mapped disk file • Page faults fetch from heap file instead of system page file

  22. Extending Addressability • Persistent Heap with > 232 objects • Need translation table to convert from 32 to 64 bit address • Page fault fetches from Persistent Heap and sets up translation • Application limited to 232 objects per invocation

  23. Data Compression Paging • Paging is slow - 20 ms seek time on disk plus transfer time • Many data pages can be compressed 4:1 • Instead of swapping out a page, compress it • Page fault to compressed page will decompress it rather than read from disk

  24. VM Primitive Performance Garbage collection for 4096 byte page = 500 msec

  25. VM Primitive Performance

  26. VM Primitive Performance • OS Authors didn't pay much attention to VM Performance • Why? • Seek time ~ 20 msec • Read time ~ 1 msec • Page fault happens in parallel with another task • Why do we care? • Many of the algorithms in this paper don't involve the disk

  27. Conclusions "… page-protection and fault-handling efficiency must be considered as one of the parameters of the design space." "It is important that hardware and operating system designers make the virtual memory mechanisms required by these algorithms robust, and efficient."

  28. Conclusions "… page-protection and fault-handling efficiency must be considered as one of the parameters of the design space." "It is important that hardware and operating system designers make the virtual memory mechanisms required by these algorithms robust, and efficient."

More Related