You are on page 1of 4

OS Qualification Exam edited by lii

Memory Management Computing Problems

1. Suppose we have a computer system with a 38-bit virtual address, 16K pages,
and 4bytes per page table entry.
(a) how many pages are in the virtual address space?
(b) Suppose we use two-level paging and arrange for all page tables to fit into a
single page frame. How will the bits of the address be divided up?
(c) Suppose we have a 32 Mbyte program such that the entire program and all
necessary page tables (using two-level paging as in part(b)) are in memory.
How much memory (in page frames) is used by the program.
2. (a) A machine is byte-addressable and has 64-bit virtual address and 32-bit
physical address. 64KB pages. How many page-table entries are needed for a
one-level page table and an inverted page table?
(b) Let each page table entry occupy 16 bytes, and a 4-level paging system be
adopted. Consider a process with 260 MB, including code and data segments.
How many pages are needed for storing the page tables for the process?
3. (a) Given a computer system with a 32-bit virtual address, 1K pages, and 4bytes
per page entry, how many levels of a paging scheme would you recommend?
(b) Suppose that the computer system has 1GB main memory. What is the
number of entries in the inverted page table?
4. A hardware company designs a CPU with two-level paging virtual memory. The
page size is 512 bytes. Each page table entry occupies 2 bytes (16 bits). In the
page table entry, there are two bits reserved for present bit and modified bit. All
the remaining 14 bits can be used to store frame numbers.
(a) How many bits is a logical address (derive it from the given information)?
(b) How many bits a physical address (maximum) can be?
(c) What is the maximum size (in bytes) of physical memory can be installed on
this machine?
(d) A program with size 348 KB is loaded into memory. What is the maximum
number of page tables should be allocated for the process?
5. Consider the following hardware configurations.
Page size 8K bytes, logical address space 32 GBytes, RAM installed 512 M.
(a) How many bits is a logical address?
(b) If this virtual memory system operates in 2-level paging in the figure below.
P1 P2 Offset
assume page table size is equal to page size, P1 and P2 have a same number of
bits. How many bytes a page table entry should occupies?
(c) Let the virtual memory system operate in 2-level paging as in (b). If a
program’s size is 5 M, how many page tables should be allocated for the
program?
(d) If an inverted page table virtual memory system is implemented, how many
page table entries are needed in the inverted page table?
(e) Inverted page table is considered more advanced than two-level paging.
6. Assume a page size of 8 KB and that a page table entry takes 4 bytes, how many
level of page tables would be required to map 64-bit logical address space (it is
possible that the outmost page table size needed is less than page size. Such case
does not complicate the memory management of OS) ?
7.
P1=10 bits, P2=10 bits, Offest=12 bits. Page table size= frame size.
How many bytes does the physical memory space size occupy?

File System Computing Problems

8. In a DOS FAT 16 file system.
A pointer is 2 byte long to index a data block.
The size of a data block is exactly on sector. A sector is 512 bytes.
The hard disk has 8 sectors for each track.
Assume the rotation latency can be ignored.
Reading one block needs 1 ms.
Assume the FAT is read into memory, so traversing the links costs nothing.

The following is the beginning of a FAT. Bolded fonts are the FAT pointers.
The last pointer of a file is ended with 00 00.
A free data block is marked with FF FF.

0 1 2 3 4 5 6 7 8 9 A B C D E F
0000: FF FF FF FF 20 00 FF FF 05 0 06 00 0C 00 FF FF
0
0010: FF FF FF FF FF FF FF FF 0D 0 0E 00 14 00 FF FF
0
0020: 21 00 22 00 23 00 00 00 00 0 FF FF FF FF FF FF
0
Now there is a file “ hello.txt” has a starting FAT pointer 00 04.
(a) Please compute how many time (in ms) is needed to read “ hello.txt”.
(b) What is the maximum capacity (in bytes) of this file system?
(c) Propose a scheme to manage the free data blocks for this example and explain
9. An Unix i-node of a file named “ hello.txt” is like the figure below:

There are 10 direct entries (file pointers) to point to data block directly and three
indirect entries to point to indirect block which contain file pointers. Suppose
each entry (file pointer long) is 2 bytes long. Each block is 512 bytes.
(a) According to the structure of this i-node, what is the maximum size of this file
system? ( you can compute the data blocks only and ignore the space reserved
for i-nodes and bitmaps)
(b) Suppose “ hello.txt” has size of 10 KB. How many file pointers are used in the
i-node and any indirect blocks. (i.e. the indirects in i-node are counted)

10. Suppose you want to format a partition into a FAT 16 file systems. One block
size is 4 sectors and a sector is 512 bytes. Suppose in the partition, the size of
reserved to store data blocks is 4 M. What is the size of FAT (in bytes)?
11. An Unix i-node is like the figure below:

In this file system, a block is 8 sectors. Each entry is 4 bytes long.

(a) If a file’s length is 48 K, how many entries are used in its i-node? (you can
ignore the entries in data block if indirect entries are used)
(b) If the single indirect entry is used, what is the maximum size of a file can be?
(c) Please describe i-node is better than FAT in what ways?