CS4410/4411: Operating Systems

Fall 2012, Prof. Sirer

Miniproject: malloc() and free() implementation FAQ


Q: Does our implementation of malloc need to be thread-safe?

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


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.


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

© 2011, Cornell University