Memory Management Strategies

RushBsite·2022년 6월 10일
0

OS

목록 보기
1/1
post-thumbnail

intro: 메모리 매니지먼트의 필요성

일반적인 pc 환경에선 physical 메모리에 동시 다발적으로 여러 process(thread)들이 저장된다.
따라서, 점유되고있는 메모리 공간을 타 프로세스나 os가 침범하지 못하도록 하는 Protection mechanism이 제공되어야한다.


기본 아이디어 : two registers

2개의 레지스터값

  • base register (시작 메모리 주소)
  • limit register (프로세스 범위 크기)

를 사용하여 base 값보다 크거나, base+limit 값보다 작은 타 프로세스의 메모리 접근을 막는다.

Logical vs Physical Address space

그런데, 프로그램이 메모리 접근 수행시 항상 real physical memory를 사용한다면, 여간 복잡한 일이 아닐것이다.
본인 영역의 physical memory 공간을 찾아야하고, 타 process의 공간을 침범하지 않게 일일이 신경써줘야하니까..

그래서 Virtual Address 를 사용한다.

//virtual address 사진

logical address 와 physical address

  • Logical address(or virtual address)
    - CPU에 의해 만들어진 address
  • Virtual address space
    - 프로세스나 프로그램의 실행에 의해 생성되는 set of addresses
    vs
  • Physical address
    • 실제 DRAM(physical memory)상의 address
  • Physical address space
    • 각logical address가 실제로 physical memory에 할당된 공간

MMU

Logical address space 를 내부 연산하여 알맞은 Physical address space로 translate 하는 In-processor hardware

Memory Mapping and Protection

// pcb 사진

위의 메모리 보호 방법은 다음과 같은 문제점을 가진다.

// contiguous memory 사진

해결법 : contiguous memory allocation

새로운 문제 : External Fragmentation(메모리 조각화)

메모리 조각화 해결법 1 : Compaction

메모리 조각화 해결법 2 : Non - contiguous address space of processes

-> paging


Paging

페이징이란?

//페이지와 프레임 사진

Address Translation Architecture

새로운 문제 : Internal Fragmentation

페이징: Memory Protection

페이징: Valid-Invalid Bit

Hierarchical page Table


Segmentation

segment table


TLB


Case Study

Intel Pentium

profile
게임 기획/개발 지망생

0개의 댓글