project - CSE 361S Intro to Systems Software Final Project...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CSE 361S Intro to Systems Software Final Project Due: Thursday, December 3, 2009. In this project, you will be writing a dynamic storage allocator for C programs (i.e., your own version of malloc , free , and realloc ). You are encouraged to explore the design space creatively and implement an allocator that is correct, space efficient, and fast. You may work in a group of up to two people. Logistics Start by downloading the file malloclab-handout.tar from the class web page and putting it in your working directory. Then give the command: tar xvf malloclab-handout.tar This will cause a number of files to be unpacked into the directory. The only file you will be modifying and handing in is mm.c . The mdriver.c program is a driver program that allows you to evaluate the performance of your solution. Use the command make to generate the driver code and run it with the command ./mdriver –V . (The –V flag displays helpful summary information.) Looking at the file mm.c you’ll notice a C structure team into which you should insert the requested identifying information about the one or two individuals comprising your programming team. Do this right away so you do not forget. When you have completed the project, you will hand in only one file ( mm.c ), which contains your solution. How to Work on the Lab Your dynamic storage allocator will consist of the following four functions, which are declared in mm.h and defined in mm.c . int mm_init(void); void *mm_malloc(size_t size); void mm_free(void *ptr); void *mm_realloc(void *ptr, size_t size); The provided mm.c file implements an extremely simple but still functionally correct malloc package. Using this as a starting place, modify these functions (and possibly define other private static functions), so that they obey the following semantics: mm_init : Before calling mm_malloc , mm_realloc , or mm_free , the application program (i.e., the trace-driven driver program that you will use to evaluate your
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 implementation) calls mm_init to perform any initializations, such as allocating the initial heap area. The return value should be –1 if there was a problem in performing the initialization, 0 otherwise. mm_malloc : The mm_malloc routine returns a pointer to an allocated block payload of at least size bytes. The entire allocated block should lie within the heap region and should not overlap with any other allocated chunk. Your mm_malloc implementation should always return 8-byte aligned pointers. mm_free : The mm_free routine frees the block pointed to by ptr . It returns nothing. This routine is only guaranteed to work when the passed pointer ( ptr ) was returned by an earlier call to mm_malloc or mm_realloc and has not yet been freed. mm_realloc
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

project - CSE 361S Intro to Systems Software Final Project...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online