[OS] 7. Address Space

dnjstjt12·2024년 11월 3일

Address in computers

  • Physical address: 메모리의 실제 주소

  • Logical address(Virtual address): CPU가 읽는 가상의 메모리 주소

  • Memory Management Unit(MMU): VA를 PA로 변환할 때 사용

  • Processor는 VA를 보고 MMU에 의해 VA가 PA로 변환된다.

Fixed Partitions

  • 메모리를 미리 분할하고 하나의 partition에 한 프로그램만 할당하는 방식이다.

  • VA에 Base register의 값을 더해 PA로 변환된다.

장점: 쉽게 구현가능하고, 쉽게 PA로 변환되고, context switch가 빠르다.

단점: Partition의 크기가 정해져있어 프로세스 크기가 Partition보다 크면 실행하지 못한다.
Internal Fragment가 발생할 수 있다. 즉 memory utilization이 낮다.

Variable Partitions

  • OS가 프로세스들의 메모리 사이즈를 알고 있다고 가정한다.

  • VA에 Base register의 값을 더하고 Limit register의 값과 비교한다.

장점: Internal Fragment는 해결 가능하다
단점: External Fragment가 발생할 수 있다.

First-fit allocation: 할당가능한 첫번 째 hole에 할당
Best-fit allocation: 할당가능한 hole중 딱 맞는 hole에 할당
Worst-fit allocation: 할당가능한 가장 큰 hole에 할당

Segmentation

  • Variable Partition의 연장이다.

  • 프로세스의 Logical address를 Segment로 나눈다.

  • 프로세스는 Segment table을 가진다.

  • CPU는 Segment-table base register를 보고 PA로 할당한다.

단점: 여전히 External fragment가 발생할 수 있다. 이를 해결하기 위해 paging기법을 사용한다.


[참고] Operating Systems Three Easy Pieces/Remzi H.Arpaci-Dusseau/ CreateSpace Publishing

profile
안녕하세요!

0개의 댓글