본문 바로가기
CS/3-1 컴구

[컴퓨터구조] #17. Virtual Memory(1)

by 이지이즤 2022. 6. 4.

 

Lec 17. Virtual Memory_1 (Large and Fast: Exploiting Memory Hierarchy)

 

- Virtual Memory
  : technique provided by operating systems

  • Physical address: address in main memory
  • Virtual address: address in virtual space
  • Virtual memory: technique that uses main memory as a “cache” for secondary storage     
                               메인메모리를 secondary storage에 대한 cache인 것 처럼 다룸.

 

- Motivation of Virtual Memory
  1) Sharing of memory among multiple programs
      복수개의 프로그램을 하나의 메인메모리만 가지고 사용.

 
2) A single user program may exceed the size of main memory

 


 

- Virtual Memory
  ▪ main memory and secondary storage (HDD)
    : Virtual memory automatically manages the 2 levels of memory hierarchy
  ▪ pages (typically 4KB) : Virtual space is split into fixed-sized blocks
  ▪ Load only required pages for execution to physical memory
  ▪ Page fault : a virtual memory miss
  ▪ Page tables : Operating systems create, contain the translation information
                                                                                       (virtual page -> physical page)

- Two Programs Sharing Physical Memory

  OS maps VA to PA by creating page table

 

- Address Translation
  : A virtual address is translated to a physical address by a combination of
    hardware(memory management unit) and software

 

- Page Tables
  : OS creates a page table for each process (that is, each program).
    VA to PA address translation 정보가 담겨있음. 프로그램마다 존재함.

  ▪ Page table is located in main memory
  ▪ Page table is composed of page table entries (PTEs)
  ▪ PTE is indexed by virtual page number
  ▪ Page table register in CPU points to page table in main memory

  1) requested page is present in main memory
     : PTE stores the physical page number plus other status bits
       (referenced 참조한 적 있는지,
        dirty 내가 갖고있는 메인메모리page내용과 secondary page내용이 같은지 다른지, …)

  2) requested page is not present in main memory (page fault)
     : PTE can refer to a location in swap space on disk
  * swap space : space on the disk reserved for the full virtual memory space of a process (program).
                           disk라는 커다란 공간에서 내가 실행하려는 프로그램의 각 페이지들을 담고있는 공간.
                           어떠한 경우에도 특정 virtual page는 swap space에 들어있음이 보장됨.

 

- Address Translation Mechanism

 

 

 

'CS > 3-1 컴구' 카테고리의 다른 글

[컴퓨터구조] #18. Virtual Memory(2)  (0) 2022.06.07
[컴퓨터구조] #16. Cache(2)  (0) 2022.06.03
[컴퓨터구조] #15. Cache(1)  (0) 2022.05.29
[컴퓨터구조] #14. Pipeline MIPS(3)  (0) 2022.05.20
[컴퓨터구조] #13. Pipeline MIPS(2)  (0) 2022.05.13

댓글