UNIVERSITY OF WISCONSIN-MADISON
Computer Sciences Department
CS 537
Spring 2000
A. Arpaci-Dusseau
Quiz #6: Wednesday, March 29

Name: Student ID #:

Memory Management

Problem 1: General Memory Allocation (60 points)

Assume that you have free memory partitions of size 100KB, 500KB, 200KB, 300KB, and 600KB (in this order) and that memory requests for 212KB, 417KB, 112KB, and 426KB arrive.

a)Show how a First-Fit allocation algorithm would assign the requests to free memory. (Do NOT assume rotating First-Fit). Clearly show the size of each piece of memory after each request arrives.










b)Show how a Best-Fit allocation algorithm would assign the same requests. Clearly show the size of each piece of memory after each request arrives.










c)Show how a Worst-Fit allocation algorithm would assign the same requests. Clearly show the size of each piece of memory after each request arrives.









Problem 2: Buddy-Allocation (40 points)

Consider a system with 1MB of available memory and requests for 42KB, 396KB, 10KB, and 28KB. Show the amount of memory allocated for each request and the state of memory after each request.






















b)Why does internal fragmentation occur with buddy allocation? How much internal fragmentation exists in this scenario?








c)Why does external fragmentation occur with buddy allocation? How much external fragmentation exists in this scenario?