Programming Assignment 4: Heap Management

Due: December 3 2018 5:30PM

Heap Management代写 you will need to implement a library that interacts with the operating system to perform heap management.

Heap Management代写
Heap Management代写

Description

In this assignment you will build your own implementation of malloc and free. That is, you will need to implement a library that interacts with the operating system to perform heap management on behalf of a user process as demonstrated in class.

You may complete this assignment in groups of two or by yourself. If you wish to be in a group of two the group leader must email me your group member’s names by November 26th, 2018. Your email must have the subject line “3320 [Section #] Project 4 Group” where section number is 002 or 003. ( 003 is the 5:30pm class, 002 is 7:00pm ) Heap Management代写

The code you submit for this assignment will be verified against a database consisting of kernel source, github code, stackoverflow, previous student’s submissions and other internet resources. Code that is not 100% your own code will result in a grade of 0 and referral to the Office of Student Conduct.

This project must be completed, in C, on omega.uta.edu. Windows does not support the sbrk() system call and MacOS/OSX’s implementation of shared libraries is unconventional.

Getting the Source Heap Management代写

The source code for this assignment may be found at: https://github.com/CSE3320/Heap

Building and Running the Code

The code compiles into four shared libraries and four test programs. To build the code, change to your top level assignment directory and type:

make

Once you have the library, you can use it to override the existing malloc by using LD_PRELOAD:

$ env LD_PRELOAD=lib/libmalloc-ff.so cat README.md

or

$ env LD_PRELOAD=lib/libmalloc-ff.so tests/test1

To run the other heap management schemes replace libmalloc-ff.so with the appropriate library:

Best-Fit: libmalloc-bf.so

First-Fit: libmalloc-ff.so

Next-Fit: libmalloc-nf.so

Worst-Fit: libmalloc-wf.so

Program Requirements (75pts) Heap Management代写

Using the framework of malloc and free provided on the course github repository:

  1. Implement splitting and coalescing of free blocks. If two free blocks are adjacent then combine them. If a free block is larger than the requested size then split the block into
  2. Implement three additional heap management strategies: Next Fit, Worst Fit, Best Fit (First Fit has already been implemented foryou).
  3. Counters exist in the code for tracking of the followingevents:
  • Number of times the user calls mallocsuccessfully
  • Number of times the user calls freesuccessfully
  • Number of times we reuse an existingblock
  • Number of times we request a newblock
  • Number of times we split ablock
  • Number of times we coalesceblocks
  • Number blocks in freelist
  • Total amount of memoryrequested
  • Maximum size of theheap

The code will print these statistics upon exit and should look like this:

mallocs: 8

frees: 8

reuses: 1

grows: 5

splits: 1

coalesces: 1

blocks: 5

requested: 7298

max heap: 4096

You will need to increment these counters where appropriate. Heap Management代写

  1. Four test programs are provided to help debug your code. They are located in the tests directory.
  2. Create benchmarks to analyze the metrics above for the different strategies for thefive benchmark programs to be posted in the

Report Requirements (25pts) Heap Management代写

Each team will be required to provide a written report in PDF format that discusses:.

  • Benchmarks: Adiscussion on how you benchmarked your library and what the results were. You should address:
    • Which heap management strategy does the best job of reusing free blocks? Which one isthe worst?
    • Which heap management strategy requires the least amount of heap space? Which one isthe worst?
    • Which heap management strategy allows for the most splits? most coalescing?least?
    • Which heap management strategy was the fastest?slowest?
    • Consider the benchmark
      • Which one requires the most mallocs?frees?
      • Which one requests the most amount ofspace?
      • Which one requires the largestheap?
  • You must provide graphs of data and diagrams to backup your
  • Analysis: A discussion of the followingquestions:
    • Which heap management strategy suffers the most from fragmentation (whattype)?
    • Which heap management strategy is thebest?
    • You should provide evidence for your
  • Summary: A summary of what you learned about memory
  • Note, you must incorporate images, graphs, diagrams and other visual elements as part ofyour report.
  • Your report must be in PDF

Extra Credit (10pts) Heap Management代写

  • Implement realloc andcalloc:

void *calloc(size_t nmemb, size_t size);

void *realloc(void *ptr, size_t size);

How to submit homework

  1. Submit a gzipped tarball of your source code and the PDF onblackboard. Heap Management代写
Heap Management代写
Heap Management代写

更多其他:   心理学论文代写 哲学论文代写 毕业论文代写 论文代写 prensentation代写 Case study代写 Academic代写 Review代写 Resume代写

合作平台:天才代写 幽灵代写  写手招聘