1 / 10

Red-Black Trees Shared Memory de-duplication

Red-Black Trees Shared Memory de-duplication. Design and Analysis of Algorithms- Fall 2010 Azade Nazi Rasool Fakoor. KSM is daemon in the kernel (called ksmd ) Periodically performs page scans I dentify duplicate pages Merges duplicates to free pages for other uses .

aloha
Download Presentation

Red-Black Trees Shared Memory de-duplication

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. Red-Black Trees Shared Memory de-duplication Design and Analysis of Algorithms- Fall 2010 Azade Nazi RasoolFakoor

  2. KSM is daemon in the kernel (called ksmd) • Periodically performs page scans • Identify duplicate pages • Merges duplicates to free pages for other uses. • duplicate pages are merged • Marked read only • if one of the users of the page changes it for any reason, that user will receive his or her own copy (Copy On Write) Kernel Shared Memory

  3. If KSM scan all pages in the system, • Wasteful of CPU and memory . • Therefore, applications can register the virtual areas that are likely to contain duplicate pages. • Volatile or non-volatile pages • KSM uses a simple 32-bit checksum. • Checksum is calculated during scan and stored with the page. • On a subsequent scan, if a newly computed checksum is different from the previously generated checksum, the page is changing so not a good candidate for merging. Kernel Shared Memory

  4. In the current KSM, pages are managed by two red-black trees, one of which is ephemeral. • Unstable tree • Candidate pages for merging (unchanged for some time) • Not write protected • stable tree, • Stable pages and merged pages by KSM • Write protected Data structure

  5. Search page in the tree

  6. Search the page in stable tree • Yes: merge the page • No: Search the page in unstable tree • No: Insert in unstable tree • Yes: • merge the page • Remove from unstable tree • Insert page to stable tree Insert page

  7. Check the memory to find the page for update • Not such a page so Insert it • Other wise search unstable tree to find “Y” • Yes: • merge the page • Remove from unstable tree • Insert page to stable tree • Find the “X” in unstable tree(Remove “X”) • Yes: Remove “X” • No: In stable tree • has two ID so transfer the page to the unstable tree • More than two so just remove ID related to “X” Update (ID,X) to (ID,Y)

  8. Search Stable tree to find “Y” • Yes: • Add the page ID of “X” to the node • Remove the “X” • No: (“Y” doesn’t exist neither in unstable tree nor stable tree) • If “X” is in unstable tree change the content to “Y” • Else (“X” in stable tree) • has two ID so transfer both(X,Y) to the unstable tree • More than two so remove ID of “X” from the node and Insert “Y” to unstable tree Update (ID,X) to (ID,Y)

  9. Demo

  10. ? Thanks

More Related