Computer Science/OS

9강. 연습문제

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

9.4 Assume that we have a demand-paged memory. The page table is held in registers. It takes 8milliseconds to service a page fault if an empty frame is available or if the replaced page is not modified and 20 milliseconds if the replaced page is modified. Memory-access time is 100 nanosecondes.

Assume that the page to be replaced is modified 70percent of the time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200nanoseconds?

 

9.6 Discuss situations under which the most frequently used page replacement algorithm generates fewer page faults than the least recently used page-replacement algorithm. Also discuss under what circumstance the opposite holds.

MFU algorithm : 가장 많이 사용된 Page를 Replacement.

LRU algorithm : 가장 오래전에 사용된 Page를 Replacement.

LRU > MFU ⇒ 특정 Page가 반복적으로 많이 사용되는 상황.

MFU > LRU ⇒ 다양한 Page들이 번갈아가며 사용되는 상황.

memory 용량이 4일때

MRU works better : 1,2,3,4,4,4,5,1

LRU works better : 1,2,3,4,4,4,5,4

9.7 Consider a demand-paging system with the following time-measure ultilizations:

  • CPU utilization 20%
  • Paging disk 97.7%
  • Other I/O devices 5%

For each of the following, say whether it will(or is likely to) improve CPU utilization. Explain your answers.

a. Install a faster CPU

b. Install a bigger paging disk.

c. Increase the degree of multiprogramming.

d. Decrease the degree of multiprogramming.

e. Install more main memory.

f. Install a faster hard disk or multiple controllers with multiple hard disks.

g. Add prepaging to the page-fetch algorithms.

h. Increase the page size.

 

현재 CPU 효율이 낮고, Paging disk가 높은걸 보면 Paging하는데 시간이 오래 걸리는 것을 알 수 있다.

Paging에 시간이 오래 걸린다 → Memory가 적어 Memory 공간과 disk 공간을 Swapping하는데 시간이 오래 걸린다.

 

a. Install a faster CPU → No

CPU 효율이 낮다 → System이 Paging하는데 많은 시간을 쓰고 있다.

따라서 CPU 성능이 좋아진다고 해서 CPU 효율이 좋아지지는 않는다.

 

b. Install a bigger paging disk → No

Paging disk가 더 커진다면 더 많은 Pages를 Secondary storage disk에 저장하여 Paging disk 효율이 좋아지지만, CPU 효율이 좋아지지는 않는다.

 

c. Increase the degree of multiprogramming. → No

Multiprogramming의 정도를 증가시키면 Memory에 올라가는 프로그램의 갯수가 증가하게 되고, 더 많은 Memory공간을 필요로 하지만, Memory공간이 부족하여 Disk와 Memory의 Swapping이 더 많이 발생하게 된다. 따라서 CPU 효율은 증가하지 않는다.

 

d. Decrease the degree of multiprogramming. → Yes

Multiprogramming의 정도를 감소시키면 Memory에 올라가는 프로그램의 수가 감소하여 한 프로그램이 더 많은 Memory를 사용할 수 있다. 따라서 Disk와 Memory간의 Swapping이 감소하여 CPU사용량이 증가하게되고 CPU 효율이 증가한다.

 

e. Install more main memory. → Yes

Memory가 커지면 한 프로그램이 사용할 수 있는 Memory가 증가하고 Swapping이 감소하여 CPU사용량이 증가하고 CPU 효율이 증가한다.

 

f. Install a faster hard disk or multiple controllers with multiple hard disks. → Yes

hard disk의 입출력 속도가 빨라지면 Swapping하는데 속도가 빨라져 CPU를 더 많이 사용하게 되고 CPU효율이 증가한다.

 

g. Add prepaging to the page-fetch algorithms. → Yes

prepaging schema에서 CPU가 page를 요청하기 전에 page를 Main Memory위로 올린다.

따라서 Swapping하는데 시간이 줄어들어 CPU를 더 많이 사용할 수 있고 CPU효율이 증가한다.

 

h. Increase the page size. → No

Page size가 증가하면, Memory안에 상주하는 Page의 수가 줄어들고, Page fault의 수가 증가하여 Disk Swapping이 더 많아진다. 따라서 CPU효율이 증가하지 않는다.

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

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