[MIPS] Virtual memory
Virtual memory란?
실제로 존재하는 memory가 아닌 논리적으로 존재하는 memory입니다.
Virtual memory는 memory의 성능보다는 protection 즉 정보를 보호하기 위해 존재한다고 할 수 있습니다.
Terminology
page - virtual memory block
miss - page fault
그림을 보면서 살펴보겠습니다.
Virtual memory에 address가 있으면 physical memory에서 data를 가져오고,
virtual memory에 address가 없으면 hard disk에서 data를 가져와 CPU에 전달하게 됩니다.
마치 HD(Hard disk)의 cache($)처럼 사용하게 되는 것이죠.
Program이 실행될 때 program은 virtual memory가 있다고 생각하고 address를 생성하고,
virtual memory의 주소를 실제 존재하는 physical address로 바꿔주는 과정이 필요하게 됩니다.
이 과정을 physical mapping이라고 하며 HD에서 수행을 합니다.
Physical mapping의 결과는 physical table에 physical page로 작성합니다.
이때 physical table은 memory에 존재하고,
Memory access를 빠르게 하기 위해 physical table의 일부를 cache($)에 두는데 그 것을 TLB라고 부릅니다.
(Locality로 인해 빠른 access 가능)
즉, virtual memory는 프로그램의 가상 주소 공간을 의미합니다.
◡̈