CS4410/4411: Operating Systems

Fall 2011, Prof. Sirer

Miniproject: malloc() and free() implementation FAQ

Q1

Thread-safety is not something you need to be worried about for the project. As an extracredit you can implement trhread-safe version of malloc() and free().

Q2

Q: Can we assume that get_memory will always return the least number of pages, not bytes, which satisfies the request; e.g. get_memory(1) will return a pointer to a memory segment which is sysconf(_SC_PAGESIZE) bytes in size?

A: Your implementation should not rely on this assumption, since the actual implementations of sbrk might vary. Simply request multiple of page size.

Tips

Alternative way to run test files with your malloc is:
env LD_PRELOAD="/path/libmalloc.so" ./test1

© 2011, Cornell University