CS372: Homework 2

Problem 1: (based on reading; not covered in lecture)

Segmented memory schemes (as well as user-level memory allocators like malloc() and, later in class, some disk placement schemes) use various policies for fitting variable sized allocation units into variable-sized spaces. Concoct a scenario in which Best-fit allocation outperforms First-fit, Worst-fit, and Buddy allocation (see the book for details on these algorithms). Repeat for First-fit v. the others, Worst-fit v. the others, and Buddy allocation v. the others.

Problem 2 (based on reading; not covered in lecture)

Describe the data structures required to implement best-fit memory allocation.

Problem 3

This question refers to an architecture using segmentation with paging. In this architecture, the 32-bit virtual address is divided into fields as follows:

4 bit segment number 12 bit page number 16 bit offset

Here are the relevant tables (all values in dexadecimal):

Segment Table Page Table A Page Table B
0Page Table A 0CAFE 0F000
1Page Table B 1DEAD 1D8BF
x(rest invalid) 2BEEF x(rest invalid)
3BA11
x(rest invalid)

Find the physical address corresponding to each of the following virtual addresses (answer "bad virtual address" if the virtual address is invalid):

  1. 00000000
  2. 20022002
  3. 10015555