Tutorial Week 8
  • What is the difference between internal and external fragmentation? Ans: Internal fragmentation is when a process is given memory and is not using all of it, as in the buddy system. External fragmentation is when their are lots of small entries on the free list that cannot easily be used.
  • Consider a variable size partition memory management scheme where the free list consists of the following partitions, ordered as given: 10k, 4k, 20k, 18k, 7k, 9k, 12k and 15k Which hole is taken for successive segment requests of 12k, 10k, 9k and 8k for first fit, best fit, worst fit. What holes are left? Ans: First fit: 20k, 10k, 18k, 8k hole left in 20k hole; left- 4k, 9k, 7k, 9k, 12k, 15k Best fit: 12k, 10k, 9k, 15k; left - 4k, 20k, 18k, 7k, 7k Worst fit: 20k, 18k, 15k; left - 10k, 4k, 8k, 8k, 7k, 9k, 8k, 6k
  • Which of first fit, best fit or worst fit is used by MSDOS? Why? (See the textbook.) Ans: All of them. Because of the horrible memory model. You may need a different strategy for badly fragmented upper memory to ordinary memory.
  • Discuss an algorithm to implement ``realloc''. What assumptions does this make about a memory allocation scheme? Ans: if new_size == old_size return old_ptr if new_size < old_size free spare blocks at the top return old_ptr if there is a free block size (new_size - old_size) above and contiguous to the old one, remove this from free list return old_ptr get a block from free list of new_size set new_ptr to it copy old to new return new_ptr
  • Consider a virtual memory paging scheme for a 6 page frame memory and a 12 page virtual address space with 512 (01000) pages. Using the following page table, what are the actual physical addresses of these virtual addresses? 020, 04100, 010300, 05376 Virtual page Page index 0 2 1 2 3 3 4 5 5 6 7 0 8 4 9 1 Ans: LA 20 ! PA 02020; LA 4100 ! PA 05100; LA 010300 ! PA 04300; LA 05376 ! page frame fault. Laboratory Week 8 There is no formal laboratory this week. Use it to catch up on outstanding tutorial or laboratory material.