Professional Documents
Culture Documents
Question # 1:
Assume that the main memory has the following 5 fixed partitions with the following sizes: 100KB,
500KB, 200KB, 300KB and 600KB (in order)
a) Expalin the following allocation algorithms: First-fit, Best-fit and Worst-fit.
b) How would each of the First-fit, Best-fit and Worst-fit algorithms place processes of 212KB,
417KB, 112KB and 426KB (in order)?
c) Compute the total memory size that is not used for each algorithm.
d) Which algorithm makes the efficient use of the memory?
Answer Q 1:
Assume that the MMU is using the multiple variable partition schemes. The memory size is 2560KB,
from which the OS uses 400KB. You have the following processes:
Using the First-fit allocation technique and the multiprogramming system (FCFS), do the following
(without using compaction)
a) Load and execute the processes until P5 is loaded (do not terminate P5).
b) Every time a program is loaded, compute the external fragmentation.
c) Assuming P5 is now terminated and P6 requires 1000K, (the P3 and P4 are still in the
memory) how would you compact best the memory so to enable P6 to be loaded?
Answer Q 2:
a) Solution
b) Soultion
P2 P2 P5
1000K 1000K 500K
P3 P3 #Free#
300K 300K 400K
P3
300K
#Free# #Free# #Free#
260K 260K 260K
EF = 0 EF = 860K EF = 660K
c) Soutlion
P5 trem P5 trem
OS OS
400K 400K
P4 P4
700K 700K
#Free# P3
900K 300K
P3 #Free#
300K 1160K
#Free#
260K
Can get most free space in less moves if you move P3 up.
Question # 3:
Assume that we have the following jobs to be scheduled using FCFS algorithm with variable partition
memory scheme:
J1 50 KB
J2 120 KB
J3 70 KB
16 KB
Show how the memory will look after scheduling job 6 (assume no memory compaction is allowed)
using both FCFS and Best-fit allocation technique.
Answer Q 3:
J4 20K J4 20K J4 20K
J1 50K #Free# 30K
J5 105K J5 105K
J2 120K J2 120K J6 55K
#Free# 45K
J3 70K J3 70K J3 70K
#Free# 76K
#Free# 16K #Free# 16K #Free# 16K
Time = 0 Time = 13 Time = 16 Time = 25
Question # 4:
Assume that we have the following jobs to be executed on a time-sharing operating system
(Quantum = 4 ms) with a total user memory of 256 KB.
Show how the memory will look after loading Job No 6 using the Best-fit allocation technique with no
compaction.
Answer Q 4:
Question # 5:
Consider a logical address space of 8 pages; each page is 2048 byte long, mapped onto a physical
memory of 64 frames.
Answer Q 5:
PMT
Index Frame # Valid/Invalid
0 10 V
1 8 V
2 40 V
3 25 V
4 I
5 I
6 I
7 I
Answer Q 6:
b) PMT of P1 PMT of P2
Index Frame# V/I Index Frame# V/I
0 29 V 0 22 V
1 4 V 1 15 V
2 18 V
3 5 V
FL { 7, 2 }
c) Memory access time = 480 ns.
Associative memory access time = 50 ns.
Effective access time =
(access time for associative memory + access time for memory) * hit probability
+ (access time for associative memory + 2 * access time for memory) * miss
probability
a) Assume a page size of 1KB, the logical address space is 8KB and the physical address space
is 16KB. Answer the following questions:
i. What is the highest degree of parallelism?
ii. What is the length in bits of the physical address field?
iii. What is the length in bits of the logical address field?
iv. What is the length of the Page Table?
b) Assume that the page size is 128 bytes; the current program size is 635 bytes and the physical
space 2048 bytes. Before the program is loaded the free frame list is {10, 7, 2, 9, 12, 4, 8, 14}.
Answer the following questions after loading the above program in main memory:
i. What is the internal fragment size?
ii. What is the physical address of 128?
iii. What is the physical address of 635?
iv. What is the logical address of the 2-D physical address <10,120>?
Answer Q 7:
a)
v. 16 programs.
vi. 16KB = 24*210 = 214 14 bits
vii. 8KB = 23*210 = 213 13 bits
viii. 23 = 8 pages.
b)
v. 5
vi. 7 * 128 + (128 128) = 896
vii. 12 * 128 + (635 512) = 1659
viii. 120
Question # 8:
Consider the following segment mapping table (SMT)
Answer Q 8:
a) <0, 430> 219 + 430 = 649
b) <1,10> 2300 + 10 = 2310
c) <2,500> Trap (500 >= 100)
d) <3,500> 1327 + 500 = 1827
e) <4,122> Trap (122 >= 96)
f) <6,1952> Trap (6 is an invalid entry)
Question # 9:
Given a logical address field with the following format:
2 bits 16 bits 8 bits
Seg # Page # Page Offset
Answer Q 9:
a. 22 = 4 segments
b. 216+8 = 224
c. 28
d. 216
Question # 10:
Assume a hardware mechanism using a combined segmentation and paging. The user logical address
space can have up to 8 segments of 64KB each. Each segment can have up to 64 pages of 1024 bytes
each. Given a 4-segment user program P (S0: 4000 bytes, S1: 4000 bytes, S2: 4000 bytes, S3: 4000
bytes) and the free frame list is {12, 23, 32, 45, 57, 64, 72, 81, 99, 103, 120, 124, 108, 90, 85, 78, 67,
55, 46, 33, 25, 16, 8, 27, 38, 49, 51, 62}
Translate the following 1-dimensional logical addresses 6452 and 12846 into 1-dimensional physical
addresses after performing memory allocation.
Answer Q 10: