1 / 20

Arquitectura de Computadores

Arquitectura de Computadores. Departamento de Ingeniería Electrónica Facultad de Ingeniería. Jerarquía de Memoria Memoria Virtual Semana No.15 Semestre 2012-1 PROF. Eugenio duque Pérez eaduque@udea.edu.co Prof. Gustavo Patiño Gpatino@udea.edu.co. Virtual Memory.

gordon
Download Presentation

Arquitectura de Computadores

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. Arquitectura de Computadores Departamento de Ingeniería Electrónica Facultad de Ingeniería Jerarquía de Memoria Memoria Virtual Semana No.15 Semestre 2012-1 PROF. Eugenio duque Pérez eaduque@udea.edu.co Prof. Gustavo Patiño Gpatino@udea.edu.co

  2. Virtual Memory • The main memory can act as a “cache” for the secondary storage, usually implemented with magnetic disks. • This technique is called Virtual Memory. • There are two major motivations for virtual memory: to allow efficient and safe sharing of memory among multiple programs and to remove the programming burdens of a small, limited amount of main memory.

  3. Virtual Memory(…cont) • Main memory needs to contain only the active portions of the many programs, just as a cache contains only the active portion of one program. • This allows us to efficiently share the processor as well as the main memory. • Virtual memory implements the translation of a program’s address space to physical addresses. This translations enforces protection of a program’s address space from other programs.

  4. Virtual Memory(…cont) • Virtual memory manages the two levels of the memory hierarchy represented by main memory (sometimes called physical memory to distinguish it from virtual memory) and secondary storage. • Although the concepts at work in virtual memory and in caches are the same, their differing historical roots have led to the use of different terminlogy.

  5. Terminology • Page : A block in the virtual memory. • Page fault : A virtual memory miss. • A page fault will take millions of cycles to process. • This enormous miss penalty, dominated by the time to get the first word for typical page sizes, leads to several key decisions in designing virtual memory systems. • Memory mapping (or address translation) : With virtual memory, the CPU produces a virtual address which is translated by a combination of HW and SW to a physical address, which in turn can be used to access main memory. • Analogy : Virtual Address can be seen like book title • Physical address like location of that book in the library.

  6. Mapeo de Memoria

  7. Mapeo de Memoria (…cont)

  8. Mapeo de Memoria (…cont) • El número de bits en el page offset determina el tamaño de la página. • El número de páginas direccionables con la dirección virtual no necesita corresponder con el número de páginas direccionables con la dirección física. • Tener un número mayor de páginas virtuales, que el número de páginas físicas, es la base de la ilusión de una cantidad esencialmente ilimitada de memoria virtual.

  9. Decisiones claves para el diseño de memoria virtual

  10. Placing a page and findingitagain • If we allow a virtual page to be mapped to any physical page (fully associative placement), the operating system can then choose to replace any page it wants when a page faults occurs. • Problems : it would be necessary a full search.

  11. Placing a page and findingitagain (…cont) • In virtual memory, we locate pages by using a full table that indexes the memory. • This structure is called a page table. • A page table is indexed with the page number from the virtual address and contains the corresponding physical page number.

  12. Placing a page and findingitagain (…cont) • Each program has its own page table, which maps the virtual address space of that program to main memory. • To indicate the location of the page table in memory, the HW includes a register that points to the start of the page table. • Page Table Register.

  13. The Page Table

  14. The page table (…cont) • Because the page table contains a mapping for every possible virtual page, no tags are required. • In cache terminology, the index, which is used to access the page table, consists of the full block address, which is the virtual page number.

  15. Whathappenwitheveryprogram ? • The page table, togetherwiththeprogramcounter and theregisters, specifiesthestate of a program. • Ifwewanttoallowanotherprogramto use the CPU, wemustsavethisstate. • Later, afterrestoringthisstate, theprogram can continueexecution. Thisstateisoftenrefer as a process. • Theprocessisconsideredactivewhenitis in possesion of the CPU; otherwise, itisconsideredinactive. • Ratherthansavetheentire page table, theoperatingsystemsymplyloadsthe page tableregistertopointtothe page table of theprocessitwantstomake active.

  16. MakingAddressTranslationFast : The TLB • Since the page tables are stored in main memory, every memory access by a program can take at least twice as long: one memory access to obtain the physical address and a second access to get the data. • The key to improving access performance is to rely on locality of reference to the page table. • When a translation for a virtual page number is used, it will probably be needed again in the near future because the references to the words on that page have both temporal and spatial locality.

  17. The TLB • Accordinly, modern machines include a special cache that keeps track of recently used translations. • This special address translation cache is traditionally referred to as a Translation Lookaside Buffer (TLB). • The TLB is a cache that holds only page table mappings. Thus each tag entry in the TLB holds a portion of the virtual page number, and each data entry of the TLB holds a physical page number.

  18. The TLB (…cont)

  19. Integrating Virtual Memory, TLBs and Caches

  20. Ejemplo del procesamiento de una condición de lectura o escritura en el procesador DECStation 3100

More Related