Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose you had a computer that supported virtual memory and had 32-bit virtual

ID: 3831290 • Letter: S

Question

Suppose you had a computer that supported virtual memory and had 32-bit virtual addresses and 4KB pages. If a process actually uses 1024 pages of its virtual address space, how much space would be occupied by the page table for the process if a single-level page table was used? Assume each page table occupied 4 bytes. a) 1 MB b) 2 MB c) 4 MB d) 5 MB ii) In a virtual memory system that supports the NRU (Not Recently Used) page replacement algorithm, how are the R and M bits used to determine with page to evict from physical memory when page fault occur? a) It uses the following order or priority: 1) R=0, M=0;2)R=1, M=1;3)R=1;M=0;4)R=0;M=1. b) It uses the following order of priority: 1)R=0, M=0;2)R=1, M=1;3)R=1;M=0;4)R=1;M=0 c) It uses the following order of priority: 1) R=1, M=1;2)R=0, M=1;3)R=1;M=0;4)R=0;M=0 d) It uses the following order or priority: 1) R=0, M=0;2)R=0, M=1;3)R=1;M=0;4)R=1;M=1 File System a) Suppose a computer has a file system for a 128 GB(2" byte) disk, whether each disk block is 8KB (2" bytes). Assume the OS for this computer uses a FAT. i) How many bits does each FAT entry have a) 16 b) 25 c) 28 d) 32 ii) Assuming the entire FAT is in memory, how much memory does this FAT occupy? a) 24 MB b) 32 MB c) 48 MB d) 64 MB b) Suppose that on a different computer, the OS uses i-nodes and each disk block is 4KB (2 bytes). Assume that an i-node contains 12 direct block numbers (disk addressers) and the block numbers for one indirect block, one double indirect block, and one triple 3 indirect block. Assume also that a block number is 4 bytes i) What is the largest possible file on that computer (assuming the disk is large enough)? a) 2TB b) 4TB c) STB d) 16TB

Explanation / Answer

6.(i)
There are 2^32=/2^11 = 2^21 pages in the address space.

Therefore,
a single level page table would have 2^21 entries, where each entry is 4 bytes. Therefore, the
page table would require 4x2^21 bytes = 4 * 2MB = 8MB. This is independent
of how many pages are actually being used.

Ans (d) 8MB

6.(ii)
For a page in memory,
the R bit for a page is set upon every access to that page.

The M bit for a page is set when that page is written to.
The R bits for all the pages in memory are occasionally cleared.
When memory is full and a new page needs to be brought into memory,
the NRU algorithm chooses a page to evict from memory in the following order
of priority:
1) R=0, M=0;2) R=0, M=1; 3) R=1; M=0; 4) R=1; M=1.

The hardware must support the setting of the R and M bits of each page
(since you don't want to incur the cost of having the OS do it).
Depending on how often the R bits are cleared, you may want to have the
hardware do this as well.

Ans (d) It uses the following order of priority : 1) R=0, M=0;
2) R=0, M=1; 3) R=1; M=0; 4) R=1; M=1.


7.(a)(i)

There has to be a FAT entry for each disk block.
Since the disk is 2^38 bytes and a disk block is 2^14 bytes,
the number of disk blocks (and thus the number of FAT entries) is

2^38/2^14 = 2^24.

Since there are 2^24 entries, a block number (disk address) requires a minimum of
log(2^24) bits = 24 bits = 3 bytes.

Ans (b)24

7(a)(ii)
In this case, the minimum amount of space occupied by the FAT is the number
of entries (2^24) times the 3 bytes per entry, namely

2^24 x 3 = 16MB * 3 = 48MB.

Ans (c)48MB


7.(b)(i)

Since a disk block is 4KB (212 bytes)
and a block number is 4 (22) bytes,
there are 210 = 1024 entries per indirect block.
Therefore,
the maximum number of blocks of a file that could be referenced by the i-node is
12+2^10 + (2^10)2 +(2^10)3 = 12+2^10 +2^20 +2^30.
Thus,
the maxium size of the file would be
(12 + 2^10 + 2^20 + 2^30) x 212 = (12x 2^12) + 2^22 + 2^32 + 2^42
= 48KB + 4MB + 4GB + 4TB

Ans (b) 4TB is the largest possible file on that computer

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote