Lab 8 - Implicit Free List Memory Allocator

Lab goals:


GitHub Repository for This Lab

To obtain your private repo for this lab, please point your browser to this starting link.
Follow the protocol from previous labs and assignments to get your GitHub repository link and clone the repository onto CLEAR. The repository for this lab is

  lab-8-implicit-free-list-memory-allocator-[YOUR GITHUB ID]


Test the Memory Allocator

In this lab's repository, you will find source code, a Makefile, and some test files for a simple memory allocator based on an implicit free list. To see things work, do this:

      make
      ./mdriver

You should see output from mdriver that includes a line of measurements like this (your numbers may not exactly match these):

      Perf index = 31/40 (util) + 60/60 (thru) = 91/100


Lab Overview

The code in your repository implements a memory allocator (like the malloc function) that in this case is based on the first-fit, implicit free list with boundary tag coalescing method for accomplishing the memory allocation function. You are not expected to know exactly what this means today, but by the end of this week's lectures, you should have a much better idea.

Your next programming assignment will be to program a memory allocator of your own. You will pick the algorithms for your allocator. The lectures on "Dynamic Memory Allocation" explain more about metrics for memory allocation such as those reported by mdriver. In addition, the specification for your next programming assignment will contain more details on these mdriver measurements.

For this week's lab, you do not actually need detailed knowledge of memory allocation. However, note that the memory allocator given in your repository for this week's lab returns blocks of memory that are aligned on 16-byte boundaries. You will make it instead align on 8-byte boundaries.

To help accomplish this task, we will walk you through the code. The work you do in this lab will help you implement your next programming assignment.


Code walkthrough

See source code file mm.c in your repository, as well as the illustrations in companion PDF.


Exercise #1

Implement the changes we have discussed during the code walkthrough in mm_malloc()GET_SIZE()place()
checkblock(),  and mm_init()  to realize 8-byte alignment on a 64-bit CPU.

Exercise #2

Remove the initial word of 0's at the beginning of the memory block list.


Submission

Be sure to git push your lab before 11:55PM on Saturday at the end of this week.