memory virtualization (메모리 가상화)
- 가상화
- cpu 가상화 (system call)
- 메모리 가상화
메모리 역사
- single programming : 대용량 프로그램
- multiprogramming
- 시스템 내 여러 프로세스가 실행 가능한 상태
- CPU Throughput 극대화 (효율성, 활용성)
- CPU를 사용하지 않을 때는, 다른 프로세스들에게 양보함
- Time sharing
- Interactive I/O 등장
- Interactivity/Responsiveness 중요성(응답시간 중요성)
Multi-User, Multiprogramming에서 메모리의 문제
- 물리적 메모리는 제한된 용량
- 심지어 하나의 프로그램 수행에도 부족 - Overlay 기법 도입
-
Overlay 기법이란?
- 프로그래머의 전적인 책임
- 여러 프로세스는 당연히 더 많은 용량 필요
- 여러 프로세스가 메모리를 함께 사용 - 분할 점유 또는 공유
- Context Switch 효율화
- 보호 문제 대두
메모리 가상화는 어떻게 이루어지는가?
- 각 프로세스에게 매우 큰 독점 메모리가 있다는 환상을 부여
Address Space (가상 주소를 대표)
- 각 프로세스가 보는 메모리의 모양
- 개념적 구조
- 프로그램 코드는 0번지부터 시작 - 실제는 아님!!

실행중인 프로그램의 모든 주소는 가상이다
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
printf("location of code : %p\n", (void *) main);
printf("location of code : %p\n", (void *) malloc(1));
int x = 3;
printf("location of code : %p\n", (void *) &x);
return x;
}
result
location of code : 0x40057d
location of heap : 0xcf2010
location of stack : 0x7fff9ca45fcc
커널/사용자 영역