Assignment 11, due July 23Machine Prolbem 5, due July 28
Part of
the homework for 22C:50, Summer 2004
|
You are to write a heap manager supporting the following interface:
A main program to test your heap manager is provided in:
http://homepage.cs.uiowa.edu/~dwjones/syssoft/spring03/hw/alloctest.c
If you change the name myalloc to malloc and you change the name myfree to free in this test program and eliminate the second parameter to myfree, you can test the test program using the built-in heap manager.
Your storage manager should use the buddy system (see figures 14.3 and 14.4 in the notes). Since this much code is already given, the real assignment is as follows:
Strong advice: Do this incrementally. First solve the problem of finding one block or blocks. Then get the heap manager working with that block, then try to get the rest of the memory into the heap.
int fibonacci(int i); { int f1,f2; if (i < 2) return i; f1 = fibonacci(i-1); f2 = fibonacci(i-2); return f1 + f2; }
Describe the contents and structure of the activation record for fibonacci() taking into account everything you know about assembly language programming. State any assumptions you made; for example, you will get a different result if you assume f1 and f2 are stored in RAM or are temporarily assigned to registers.