TWiki> CS385spring14 Web>Homeworks>Homework4 (revision 1)EditAttach

Homework 4

Memory Allocation

Issued 2/18/14
Due Date 2/27/14 before class

NOTE: As a reminder, homework is handed in when it is committed to your personal subversion repository before the deadline. Changes made after the deadline will be ignored.

NOTE2: Please check back later, this page will be updated with more details.


One basic service each operating system provides is memory allocation. In this homework, we will be developing code that will be used to: . allocate pages for use by user space programs and our kernel . implement malloc - like functionality, for both our kernel and user space programs.

What to hand in

As for all the other homework assignments, you will need to commit your homework to your assigned subversion repository, under the correct directory ( homework/homework4).

Please commit the following files:

  • The kernel page allocator
  • The userspace/kernel object allocator
  • A and README.object file which describes how you implemented your allocator.

Task 1: Kernel Page Allocator

On the x86 architecture, the Memory Management Unit (MMU) has a concept of a page (typically 4K). A page is the smallest granularity used to keep track of memory translations.

For example, this means that access control is done on a per-page basis, and that a page is either present for a user space program or not.

Because of this, we need a memory allocator which can keep track of which pages are free and which pages are in use.

Task 2: Object Allocator

While the hardware might enforce the page concept, a typical program does not. Instead variable length memory regions are allocated (for example, enough memory to hold an array of integers).

For example, look at malloc ( man malloc.h).

Your second task is to implement a malloc-like library for our operating system.

Note: The kernel will also need to be able, for its internal bookkeeping, to allocate variable size memory regions. We will be reusing the same code in the kernel as well, where possible.


The shared repository (under solutions/homework4) contains example C code, indicating which functions need to be completed.


Your solution will be evaluated based on:

  • Code documentation and clarity
    • So far, for most people, the documentation can be substantially improved!

  • Correctness.
  • Speed (less important).
Edit | Attach | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2014-02-18 - 21:24:53 - Main.driesk
Copyright 2016 The Board of Trustees
of the University of
Helping Women Faculty Advance
Funded by NSF