Computer Science/OS

8강. 연습문제

박붕어 2023. 12. 5. 23:53

8.4 Compare the main memory organization schemes of contiguous memory allocation, pure segmentation, and pure paging with respect to the following issues:

a. external fragmentation

contiguous memory allocation : 큰 메모리공간을 연속으로 할당할 수 있는 자리에 연속적으로 큰 메모리공간을 할당하기 때문에 작은 메모리공간이 남을 수 있고 그렇게 external fragmentation이 발생하게 된다.

pure segmentation : Segment 단위로 메모리를 연속으로 할당하기 때문에 작은 free memory가 생기는 external fragmentation이 발생할 수 있다.

pure paging : physical memory를 작은 page단위로 나누어 관리하고 page단위로 메모리를 할당하기 때문에 External Fragmentation이 발생하지 않는다.

b. internal fragmentation

contiguous memory allocation : 프로그램에 필요한 메모리공간 만큼 할당을 하기 때문에 internal fragmentation이 발생하지 않는다.

pure segmentation : Segment 단위로 필요한 메모리 만큼 할당하기 때문에 internal fragmentation이 발생하지 않는다.

pure paging : page단위로 메모리를 할당하는 과정에서 프로그램에 필요한 메모리보다 많은 메모리를 할당할 가능성이 있다. 따라서 internal fragmentation이 발생한다.

c. ability to share code across processes

contiguous memory allocation : 프로그램의 private, public한 부분의 구분 없이 메모리의 연속적인 공간을 할당받기 때문에 code sharing을 할 수 없다.

pure segmentation : private, public한 부분을 분리하여 public한 segment는 공유할 수 있다.

pure paging : page단위로 메모리를 할당하기 때문에 public과 private를 분리할 수 있고 public한 부분을 프로그램끼리 공유할 수 있다.

8.7 Why are segmentation and paging sometimes combined into one schema?

Segmentation과 Paging은 서로 성능을 향상시키기 위해 합쳐질 수 있다.

Segmented Paging은 Page table이 매우 커질 때 유용하다.

Paged Segmentation은 할당하는데 시간이 오래 걸리는 긴 Segment를 처리하는데 사용된다. Segment를 page로 나눔으로써 메모리 할당을 단순화하여 external fragmentation로 인해 낭비되는 메모리를 줄일 수 있다.

8.8 Explain why sharing a reentrant module is easier when segmentation is used than when pure paging is used.

pure paging은 일정 단위의 physical memory를 기준으로 프로그램을 분리하기 때문에 특정 프로그램의 reentrant module을 공유하기 위해서는 공유하는 부분에 대한 정보가 필요하여 공유가 어렵다.

Segment는 프로그램을 기능별로 Logical한 memory를 기분으로 프로그램을 분리하기 때문에 특정 프로그램의 reentrant module 역시 segment 단위로 나뉘게 되고, 공유하기 쉽다.

8.9 What is the purpose of paging the page tables?

Page table이 커지게 되면 physical Memory공간을 차지하고 낭비하게 된다. Page table을 paging함으로써 메모리 할당의 문제를 단순화할 수 있고 현재 사용되지 않는 Page Table의 일부분을 Swap out하여 Memory를 효율적으로 사용할 수 있다.

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

9강. 연습문제  (2) 2023.12.05
Virtual Memory  (1) 2023.12.05
Memory Management (2)  (2) 2023.12.04
Memory Management (1)  (1) 2023.12.04
7강 연습문제  (0) 2023.12.02