In: Computer Science
Given a system with 4M bytes of address space per process, 64M bytes of physical memory, pages of size 1K bytes, and page table entries of 8 bytes. How many entries can fit in one page?
Select one:
a. 128
b. 1K
c. 8
d. 64K
Given a system with 16G bytes of address space per process, 8G bytes of physical memory, and pages of size 16K bytes. How many entries are there in a linear page table?
Select one:
a. 1M
b. 16K
c. 8G
d. 512K
Solution:
(1)
Given,
=>Logical address space size = 4 MB
=>Physical address space size = 64 MB
=>Page size = 1 KB
=>Page table entry size = 8 B
The answer will be an option,
(a) 128
Explanation:
Calculating number of entries in one page:
=>Number of entries in one page = page size/entry size
=>Number of entries in one page = 1 KB/8 B
=>Number of entries in one page = 1*1024 B/8 B as 1 KB = 1024 B
=>Number of entries in one page = 128
=>Hence number of entries can fit in one page = 128
=>Hence option (a) is correct and other options are incorrect.
(2)
Given,
=>Logical address space size = 16 GB
=>Physical address space size = 8 GB
=>Page size = 16 KB
The answer will be an option,
(a) 1 M
Explanation:
Logical address:
Page number | Page offset |
20 bits 14 bits
Calculating number of bits for page offset:
=>Number of bits for page offset = log2(page size in bytes)
=>Number of bits for page offset = log2(16 KB)
=>Number of bits for page offset = log2(16*2^10 B) as 1 KB = 2^10 B
=>Number of bits for page offset = log2(2^14)
=>Number of bits for page offset = 14 bits
Calculating number of bits for page number:
=>Number of bits for page number = log2(logical address space size in bytes) - number of bits for page offset
=>Number of bits for page number = log2(16 GB) - 14
=>Number of bits for page number = log2(16*2^30 B) - 14 as 1 GB = 2^30 B
=>Number of bits for page number = 34 - 14
=>Number of bits for page number = 20 bits
Calculating number of entries in linear page table:
=>Number of entries in linear page table = page table size/entry size
=>Number of entries in linear page table = number of pages*frame number bits/frame number bits
=>Number of entries in linear page table = number of pages
=>Number of entries in linear page table = 2^page number bits
=>Number of entries in linear page table = 2^20
=>Number of entries in linear page table = 1 M as 1 M = 2^20
=>Hence option (a) is correct and other options are incorrect.
I have explained each and every part with the help of statements attached to it.