Allocation of Physical Memory
※ 사용자 프로세스 영역의 할당 방법
▶ Contiguous allocation(연속 할당)
- Fixed partition(고정분할) 방식
- Variable partition(가변분할) 방식
- Register 2개: limit register, relocation register
▶ Noncontiguous allocation(불연속 할당)
- Paging
: logical address --> page table --> physical address
- logical address: (page 번호 + page 내의 위치)
- page table -- Problem: page table 엔트리가 너무 많이 필요하다 --> Solution: 다단계 paging
- page table: valid/invalid
- Segmentation
- Paged Segmentation
Inverted Page Table
▶ Paging: Logical address --> page table --> Physical address
- Problem: 모든 process별로 그 logical address에 대응하는 모든 page에 대해 page table 엔트리가 존재한다: 공간낭비
- Solution: Inverted page table
▶ Inverted page table(역방향 page table)
: page frame 하나 당 page table에 하나의 엔트리를 둔 것; 각 page table 엔트리는 각 물리적 메모리의 page frame이 담고있는 내용 표시
- Problem: page table 개수를 줄일 수 있지만, "주소변환(logical address --> physical address)" 자체에는 도움이 되지 않는다; logical address에 대응되는 엔트리를 page table에서 찾기 위해서는, page table 전체를 탐색해야 한다(pid).
- Solution: associative register --> page table의 병렬 탐색이 가능하도록 하는 하드웨어
Shared Page
▶ Shared code(Re-entrant code, Pure code)
- shared code는 모든 프로세스의 logical address space에서 동일한 위치에 있어야 한다.
- read-only로 하여, 프로세스 간에 하나의 code만 메모리로 올린다.
▶ Private code, Data
2. Segmentation
: 프로그램은 의미 단위인 여러 개의 segment로 구성된다.
<--> Paging: 프로그램은 동일한 크기의 page로 구성된다.
▶ Logical address
- segment number
- offset: logical address 길이
▶ Segment table
- limit: segment의 길이
- base: Physical address 주소
- offset < limt --> logical address --> physical address
- offset > limt --> logical address 길이가 sement 길이보다 길다: trap
▷ STBR(Segment Table Base Register): 물리적 메모리에서의 segmet table의 위치
▷ STLR(Segment Table Length Register): 프로그램이 사용하는 segment의 수
Segmentation 장/단점
※ 장점
▶ Protection(보안): 각 segment별로 protection bit가 있다.
- valid/invalid bit --> valid bit = 0: illegal segment
- Read/Write/Execution 권한 bit
▶ Sharing(공유): shared segment
--> Paging과 달리 Segmentation은 하나의 Segment가 의미 단위이기 때문에, 하나의 segment에 여러 기능이 섞이지 않는다. --> 보안(protection)과 공유(sharing)에 있어서 Paging보다 효과적이다.
※ 단점
▶ Allocation: Segment를 Physical memory의 어느 조각에 집어넣어야 하는가?
- first fit, best fit 결정
- 외부조각(external fragmentation) 발생
<-- Segment 길이가 동일하지 않으므로, 연속할당 방식(가변분할 방식)에서와 동일한 문제가 발생한다.
3. Paged Segmentation
※ Pure segmentation과의 차이점
: segment-table 엔트리가 segment의 base address를 가지고 있는 것이 아니라, segment를 구성하는 page table의 base address를 가지고 있다.
--> Allocation(외부조각 발생) 문제 해결!
▶ Logical address
- s: segment 번호
- d: segment offset
+ STBR(Segment Table Base Register)
▶ Segment table
- segment length
- page-table base
- segment length > d(segment offset) --> trap
▶ Page table for Segment
: segment마다 존재하는 page table
▶ Physical address
'운영체제' 카테고리의 다른 글
[운영체제] KOCW 11.2 - Ch9: Virtual Memory (0) | 2023.06.10 |
---|---|
[운영체제] KOCW 11.1 - Ch9: Virtual Memory (0) | 2023.06.10 |
[운영체제] KOCW 9 - Ch8: Memory Management (0) | 2023.06.10 |
[운영체제] KOCW 8 - Ch8: Memory Management (0) | 2023.06.09 |
[운영체제] KOCW 7 - Ch7: Deadlock (0) | 2023.06.09 |