80 likes | 224 Views
TUTORIAL. MEMORY MANAGEMENT (Best-Fit & First-Fit). 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 )
E N D
TUTORIAL MEMORY MANAGEMENT (Best-Fit & First-Fit)
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) • How would each of the First-fit and Best-fit algorithms place processes of 212KB, 417KB, 112KB and 426KB (in order)? • Compute the total memory size that is not used for each algorithm. • Which algorithm makes the efficient use of the memory?
Answer 1 a)
Answer 1 b) Total Fragmentation First-fit: Total Fixed Partitions – Total Process First-fit Size 1700-741 =959 Total Fragmentation Best-fit: Total Fixed Partitions – Total Process Best-fit Size 1700-1167 =533
Answer 1 c) Memeory Utilization Ratio: i. First-fit = 741 / 1700 = 43.5% ii. Best-fit = 1167 / 1700 = 68.6% *Best-fit has the most efficient use of the memory
1 2 3 4 5 6 7 8 9 12K 11 12 10K 10K 10K 10K 20K 20K 30K 30K 10K 10K 5K 5K 30K 30K 20K 20K 10K 10K 15K 15K 20K 20K 20K 20K Hole Hole Used Used Question 2 In a variable partition memory management, assume memory is allocated as specified in a diagram below: Suppose the request for memory is as follows: 18K, 12K, 7K Redraw the diagram to show how memory would look after all requests has been allocated by using the following memory allocation strategies: a)First-fit b)Best- fit
Answer 2 a) FIRST-FIT: 18K will be allocated at the first hole of size 30K 12Kwill be allocated at the first hole of size 12K 7Kwill be allocated at the first hole of size 10K
Answer 2 b)BEST-FIT: 18K will be allocated at the first hole of size 20K 12Kwill be allocated at the first hole of size 15K 7Kwill be allocated at the first hole of size 20K