Q1. Request from the processes is 300k, 25k, 125k, and 50k , respectively (in order).
The above request could be satisfied with? (Assume variable partition scheme)
- Best fit but not first fit
- First fit but not best fit
- Both best and first fit
- Neither best nor first fit
Q2.Consider the following system:
Number of pages = 2k
Page size = 4k words
Physical address = 18 bits
Calculate the logical address space (LAS) and number of frames.
Q3. Consider a system with LA = 32 bits, physical address space (PAS) = 64 MB and page size is 4 KB. The memory is byte addressable. Page table entry is 2 bytes. What is the approximate page table size?
Q4. Consider a system with TLB access time 20 ns and main memory access time 100 ns. Calculate effective memory access time if TLB hit ratio is 95%.
Q5. Consider a system with page fault service time (s) = 100 ns, main memory access time (M) = 20 ns, and page fault rate (P) =65%. Calculate effective memory access time.
Solutions :
Ans1. Option (B)
We have to check only for two algorithms best fit and first fit(as given in question). Let discuss by considering one algorithm at a time, as follows:
Best Fit:
First of all, 300k jobs will use 350k slot. Free slot will be =350-300=50k.
Next process of 25k will use remaining 50k slot (available as free from the operation above), as per the best fit algorithm. So, the free space left = 50-25= 25k.
The third process of 125k will be accommodated by 150k space, so we are left with 150-125= 25k.
Fourth process requires 50k. Now, we have two slots of 25k left but our last process is of 50k size.
Therefore, the need of all the process is not satisfied.
First fit
First process is of 300k will be use 350k slot. Remaining free space will be = 350-300= 50k.
Next process of 25k will use remaining 150k slot (as per first fit algorithm). So, free space left = 150-25= 125k.
The third process is of 125k will be accommodating by 125k slot which is left free after the allocation of the memory to second process.
Now, we have only one slot of 50k left and our process requires 50k memory.
Observing the execution of the algorithms, we can say that by using the first fit algorithm, all the processes can be executed. Therefore option (B) is the correct answer.
Ans2.
We know that
Number of pages = LAS/page size
So, LAS = Number of pages * page size
LAS = (2k *4k) words = 211 * 212 words
= 223 words = 8M words
Number of frames = PAS/frame size=218/212
Because frame size = page size, the number of frames is 26 frames = 64 frames.
Ans3.
LA=32 bits. So, LAS =232 bytes
Number of pages = LAS/ Page size = 232/212 = 220
Page table size = Number of entries * Page table entry size
220 * 2 bytes = 2MB (because number of page table entries = number of pages)
Ans4.
Given that C = 20ns, M = 100ns, X = 95%. Without TLB effective memory access time
EMAT = 2M = 2 * 100 = 200ns
With TLB, effective memory access time
EMAT = X(C + M) + (1- X) (C + 2M)
= 0.95(20 + 100) + (1 – 0.95) (20 + 2 * 100)
= 114 + 11 = 125ns
Ans5.
EMAT = P * S + (1 -P) * M
= 0.65 * 100 + (1 – 0.65) * 20
= 0.65 * 100 +0.35 * 20
= 65 + 7 =72 ns
Your article about Solved Questions – Memory Management is the best I have read!
Need more question on memory management including theory question also