CS4410/4411: Operating Systems

Fall 2014, Profs. Sirer and George

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 extra challenge you can implement a thread-safe version of malloc() and free() if you so desire.


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 a multiple of the page size.


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

© 2014, Cornell University