19. 주메모리의 관리

개발 99·2025년 4월 14일

공룡책

목록 보기
17/22

A process is program in execution
(main mememory에 있는 명령어의 집합)

A memeory = a large array of bytes, which is its own address
CPU는 PC를 이용해서 메모리에서 명령어를 fetch한다.
instruction도 load & store를 memory에 한다.

Memory space

  • 각 프로세스가 개별적인 메모리 공간을 관리해야 한다.

  • register = base register + limit register
    합법적인 주소 제어를 한다.

  • base와 base + limit를 이용해서 메모리 상 프로세스 공간을 분리한다.

  • base <= address <= base + limit 만 memory 접근 가능하고,
    그렇지 않으면 illegal addressing error

Address Binding

int a = 10; 과 같은 명령어가 실행시, 구체적인 메모리 로딩은 컴파일러가 담당한다.
exe 파일도 결국 binary executable file로 DISK에 저장.
그래서 memory에 loading을 해야 의미있다.

시작번지는 00000000이 아니라 그때마다 주소가 달라진다.

a.out이 있을 경우, 그 파일의 구성파일이 조합이 된다.(단, 주소는 모름)

linker or loader가 주소를 바인딩한다.
( symbolic addr. -> relocatable addr. -> absolute addr. )

Logical vs. Physical Address Space

Logical를 physical에 맵핑을 시켜야 한다.

  • logical address : CPU(User process)가 사용하는 주소

  • physcial address : memory에 로딩된 주소(logical과 분리)


logical을 physical address로 변환.

logical addr + relocation register를 해서 실제 메모리에 기록한다.

Dynamic Loading

실행파일 전체를 로딩할 필요 없이, 필요시에만 로딩하자
(relocatable linking loader가 필요할 떄만 program 주소 테이블에 변경사항을 반영한다.)

Dynamic Linking and Shared Libarires

  • DDLs
    프로그램이 실행중에 linking이 된다.
    (system library로서 user program과 link된다.)

  • static linking
    loader가 binary program code를 다 load

  • dynamic linking
    실행시점까지 연기. 즉, 실행되자마자 링크

Contiguous Memory Allocation

메모리에 다음과 같이 로딩한다.

  1. OS

  2. User Process

어떤 section에다 통째로 올림.(single section of memory)


(그런데 페이징에서는 안됨)


hole 관리가 문제

Fragmentation

  • 자투리 공간 = external fragmentation (CMA)

  • 프레임 내부가 남는다 = internal fragmentation (페이징)

Segmentation

종류별로 메모리를 쪼개자.
CMA ~ Paging 그 사이

요새는 페이징으로 한다!

profile
구구구구구!

0개의 댓글