-
Memory Management Stategies전공 지식/OS 2018. 8. 16. 21:31
이런 과정이 계속 일어남
Virtual Memory
- 주기억 장치의 부족한 physical memory를 보조기억장치를 이용해 가상으로 늘려줌
Address binding : 주소 결정
언제 주소가 결정되냐? Execution Time
1. Compile Time : 프로그램의 시작 위치가 바뀌면 다시 컴파일 해야함
2. Load Time : 만약 메모리가 쫒겨났다가 다시 돌아오면 address가 바뀌기에 안됨
3. Execution Time : 주소결정이 프로그램이 실행 될 때까지 최대한 미뤄지기에 가능
- Need hardware support for address maps (MMU)
- Address mapping table
MMU (Memory Management Unit) - TLB, Register
- 하드웨어 디바이스가 virtual 과 physical address mapping을 도와줌
- Simple Method = relocation register 을 통해 피지컬 어드레스로 바꿔줌
Dynamic loading (디스크 -> 메모리)
- 호출이 될 때까지 로딩을 지연시키는 것을 의미한다.
- Better memory-space utillization *메모리 활동도가 좋음
- 라이브러리에서 구현되어 있음
Dyanmic Linking
- 실행때까지 링킹을 지연시킴
1. shared libraries
- 메모리 이용률이 좋아짐
- library update시 다시 빌딩하지 않아도 됨
2. In case that library updates occurs
Swapping : Physical memory 공간이 부족해서 나오는 현상
- Backing store : 디스크의 일부를 swapping 영역으로 할당함
- Roll out, Roll in : Swapping in/out과 같음. Priority 를 도입하여 우선순위가 낮은 것을 내쫓음
Contiguous Allocation - 하나의 프로세스는 연속적으로 저장된다
- Main memory는 대부분 2개로 나뉘어서 저장된다.
Memory mapping and protection
- Relocation registers는 시작 주소를 탐고있는데 유저의 프로세스를 보호하기위해 사용
- Limit register은 logical addresses의 범위에 저장된다.
Multiple-Partition allocation
- Hole : 메모리의 이용가능한 Block
Dynamic storage allocation - Process가 들어갈 수 있는 Hole 중에 적합한 Hole이 뭔지
- First-fit
- Best-fit
- Worst-fit
Fragmentation
- External Fragmentation
남은 메모리 공간 전체는 요청을 수행할 수 있지만 연속적이지 않음
- Internal Frangmentation
할당되는 메모리 (HOLE의 크기) > 실제 메모리 크기 이기에 아무것도 할 수 없는 자투리 영역이 생김
Paging에서 자주 발생함,
Paging 기법
- 가상 메모리를 Page단위로 쪼개어 운용하는 기법으로 이때 쪼갠 단위를 Page라고 하고
실제 메모리에선 페이지와 같은 크기의 Frame 단위로 나누어 사용한다.
Paging - 연속적이지 않음. External Fragmentation 발생이 X
- Virtual memory를 Page 단위로 쪼갬
- Physical memory는 frame 단위로 쪼갬
- Process마다 Page Table이 존재함 (in PCB)
Frame Table - 비어있는 Frame 관리 (OS마다 존재)
Paging hardware support
- Use of Register
Page Table은 메인 메모리에 저장되어 있음
- TLB
Page Table을 저장함. 빨리접근해서 Table을 Lookup 할 수 있다.
'전공 지식 > OS' 카테고리의 다른 글
File System (0) 2018.10.19 Virtual Memory Management (0) 2018.08.16 Deadlocks (0) 2018.08.16 Process synchronization (0) 2018.08.09 Process scheduling (0) 2018.08.09 댓글