Ithaca College Logo Ithaca College Home Blue Header

Ithaca College, Ithaca, New York

Project 5

Fall 2005

Extra Credit

Due Date: Beginning of class, Last day of classes.


References.


Requirements.

Details

I am providing you with a first-fit memory allocator named "myAllocator" written in the 'C' programming language. MyAllocator can be used as a replacement for malloc by linking it with "malloc.c" Its "resizeRegion()" method (which allows an allocated memory region to be increased) ineptly does not consider borrowing space from the successor block should it be free (this is documented in resizeRegion's comments). For the first part of this assignment, you should:

You should test your modified memory arena mangers for proper function, both as stand-alone allocators and as malloc() replacements. I encourage you to share these test programs with each other.

My allocator is in the following tarball: myMalloc.tar. The files can be extracted to a directory named "myMalloc" using the command "tar xf myMalloc.tar"

OS Lab -Memory Allocator Evaluation

In this lab, you should evaluate the three your memory allocators (first fit, next fit, best fit) by constructing a program that allocates and frees memory for an extended period of time. This program terminates and prints statistics on memory utilization and execution cost at the first time a memory allocation request fails.

Your allocator should be dividing an arena whose initial size is 2MB, and does not grow.

The program proceeds in rounds. In each round i, a random integer between 1 and 10 is drawn, which indicates the number of regions to be allocated in round i. Each region's size should be randomly selected in the range of 8..1008 as (x mod 1000) + 8 where x is a randomly generated integer read from an input file. Recall that % is the mod operator in "c".

At the end of each round, the first region allocated for that round is freed.

I have provided a text file mallocLab-rands.txt that contains a pseudo-random sequence of integers. When your program needs a random number in the range [min..max], do so using a function udri(min, max) that

What you should report the first time a malloc fails.

Review of overhead and fragmentation

  • Debugging Hint: There is a systems program named strace that will trace all of the signals and system calls that a program receives. See the man page.
  • Administrative concerns.

    Deliverables.

  • You must demonstrate your program to me.
  • You must hand in a hard copy of all code that you use in your solution.
  • You must also put a copy of all source code that you use in your solution on the Linux Server.

  • Revision History

    Date Revision
    14 November PS posted


    Last updated on 21 Nov 2005 by John Barr