Wednesday, 22 February 2012

Virtual Memory


  • Demand paging


—   Do not require all pages of a process in memory


—   Bring in pages as required




  • Page fault


—   Required page is not in memory


—   Operating System must swap in required page


—   May need to swap out a page to make space


—   Select page to throw out based on recent history



Thrashing



  • Too many processes in too little memory

  • Operating System spends all its time swapping

  • Little or no real work is done

  • Disk light is on all the time



  •  Solutions


—   Good page replacement algorithms


—   Reduce number of processes running


—   Fit more memory



Page Table Structure



Translation Lookaside Buffer



  • Every virtual memory reference causes two physical memory access


—   Fetch page table entry


—   Fetch data




  • Use special cache for page table


—   TLB



TLB Operation



Segmentation



  • Paging is not (usually) visible to the programmer

  • Segmentation is visible to the programmer

  • Usually different segments allocated to program and data

  • May be a number of program and data segments


Advantages of Segmentation



  • Simplifies handling of growing data structures

  • Allows programs to be altered and recompiled independently, without re-linking and re-loading

  • Lends itself to sharing among processes

  • Lends itself to protection

  • Some systems combine segmentation with paging

No comments:

Post a Comment