CS 321 Spring 2013  >  Assignment 4

CS 321 Spring 2013
Assignment 4

Assignment 4 is due at 5 p.m. Tuesday, April 4. It is worth 25 points.


E-mail answers to the exercises below to ggchappell@alaska.edu, using the subject “SA4”.

Exercises (25 pts total)

Exercise A — Simple Memory Manager


In this exercise, you will write simple memory allocation & deallocation functions, using mmap to get the memory.


Write a C++ package to do memory allocation and freeing, much like the standard library functions malloc and free.


Exercise B — Memory-Mapped Random-Access File


In this exercise, you will write a program that does random-access file I/O using mmap.


Write a complete C++ program to do random-access I/O on a file. The file will contain 100 records, each holding an integer. The user is repeated allowed the choice of reading and printing the value in a specified record, or writing a user-provided value to a specified record. Data written by the program should be available for reading the next time the program is executed.


Further Notes on the Assignment

CS 321 Spring 2013: Assignment 4 / Updated: 27 Mar 2013 / Glenn G. Chappell / ggchappell@alaska.edu