Operating Systems

HW#6 with Solution

 
1. Problem 7.3 from textbook.
 
First fit: O(n/2)
Next fit: O(n/2)
Best fit: O(n)
 
 
2. Paging
 
On a 32bit machine with a 14bit page identifier:
 
a) How many pages can the system address?
 
2^14
 
b) What is the size of each page?
 
2^18 or 256KB
 
c) How many pages can be kept in a main memory of 16MB?
 
16MB = 2^24
 
(2^24)/(2^18) = 2^6 = 64
 
 
3. Segmentation
 
On a 32bit machine with a 12bit segment identifier:
 
a) What is the segment number for the logical address 0x0A839D34 (hex)?
 
0x0A8 or 168(decimal)
 
b) Assume the segment is large enough, if the base address is 0x00408200,
   what is the physical address corresponding to the logical address in
   part a?
 
0x00408200 + 0x00039D34 = 0x00441F34
 
c) What is the largest possible segment size?
 
2^20 = 1MB
 
4. Draw a diagram displaying the allocation of the following blocks of memory
   using the buddy system.  Assume a main memory of 512kB.
 
   A = 15kB
   B = 27kB
   C = 129kB
 
 
 A(15/16KB) | 16KB | B(27/32KB) | 64KB | 128KB | C (129/256KB)
 
 

·  This is just a sample HW, if something is not covered in the class than it will not be asked in the final exam.