본문 바로가기
Computer Science/Operating System

Segmentation

by Gofo 2021. 6. 20.

Segmentation

Segmentation은 과거에 주로 사용되는 기법으로 요즘은 paging을 사용한다.

 

Segment 단위로 memory management(allocate, protection, sharing)를 한다.

주로 code, dta, stack, symbol table 등의 각 영역 단위로 segment가 만들어진다.

 

paging에서 page의 크기는 모두 동일하다.

그러나 segment는 각 프로세스별, 영역별로 크기가 다를 수 있다.

 

각 segment 들이 physical memory space에 흩어져서 저장된다.

fragmentation이 줄어들기는 하지만, 아예 발생하지 않는 것은 아니다.

 

Address Translation

Address translation 과정은 paging과 유사하다.

 

Logical address는 segment number와 offset으로 구성된다.

 

Segment table을 이용해서 logical address를 physical address로 translation 한다.

Segment table에는 logical address의 segment number가 physical address 로 매핑되는 정보가 들어있다.

 

Segment table entry는 base와 limit이 존재한다.

  • base
    • physical address에서의 segment의 시작주소
  • limit
    • segment의 크기
    • 프로세스 별, segment 별로 segment의 크기가 다르기 때문에 필요하다.

 

오른쪽 예제에서 physical memory에서 segment 2의 시작주소는 4300이고 크기는 400이다.

따라서 segment table의 2번 entry는 limit = 400, base = 4300 이 된다.

 

Protection and Sharing

하드웨어적으로 reference를 자동으로 걸러낸다.

이를 통해 protection이 이루어진다.

 

segment sharing은 segment table에 공유되는 segment의 base와 limit을 넣음으로써 이루어진다.

실제 physical memory에는 하나의 segment만 올라와있지만, segment table에 정보를 넣음으로써 여러 곳에서 공유할 수 있다.

 


Segmentation 예시

MULTICS

Segmentation과 paging을 혼합해서 사용하던 시스템이다.

 

Segment 안에서 paging을 구현한다.

 

Intel 30386

Segmentation과 paging을 혼합해서 사용하는 시스템이다.

기본적으로 segmentation을 먼저 사용한다.

 

Segment table 대신 descriptor table, segment number 대신 selector라는 용어를 사용한다.

'Computer Science > Operating System' 카테고리의 다른 글

Page Replacement  (0) 2021.06.20
Memory Space Utilization  (0) 2021.06.20
Paging  (0) 2021.06.20
Memory Management  (0) 2021.06.20
Deadlock Handling  (0) 2021.06.20

댓글