Project #86026 - Buddy Memory Allocator (C++)

Implement a buddy-system memory manager that allocates memory in blocks with sizes that are power-of-two multiples of a basic block size. The basic block size is given as an argument when the allocator is initialized.

·         The memory allocator shall be implemented as a C/C++ module my allocator, which consists of a header file my allocator.h and my allocator.c. (A copy of the header file and a rudimentary preliminary version of the .c file are provided.)

·         Evaluate the correctness (up to some point) and the performance of your allocator. For this you will be given the source code of a function with a strange implementation of a highly-recursive function (called Ackermann function). In this implementation of the Ackermann function, random blocks of memory are allocated and de-allocated sometime later, generating a large combination of different allocation patterns. The Ackerman function is provided in the form of two files, i.e., the header file ackerman.h with the interface definition of the ackerman function, and the implementation in file ackerman.c.

·         You will write a program called memtest, which reads the basic block size and the memory size (in bytes) from the command line, initializes the memory, and then calls the Ackermann function. It measures the time it takes to perform the number of memory operations. Make sure that the program exits cleanly if aborted (using atexit() to install the exit handler.)

·         Use the getopt() C library function to parse the command line for arguments. The synopsis of the memtest program is of the form

 

memtest [-b <blocksize>] [-s <memsize>]

-b <blocksize> defines the block size, in bytes. Default is 128 bytes.

-s <memsize> defines the size of the memory to be allocated, in bytes. Default is 512kB.

 

·         Repeatedly invoke the Ackerman function with increasingly larger numbers of values for n and m (be careful to keep n 3; the processing time increases very steeply for larger numbers of n). Identify at least one point that you may modify in the simple buddy system described above to improve the performance, and argue why it would improve performance.

 

 

·         Make sure that the allocator gets de-allocated (and its memory freed) when the program either exits or aborts (for example, when the user presses Ctrl-C). Use the atexit library function for this.

Subject Computer
Due By (Pacific Time) 10/09/2015 11:59 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy