CS4410/4411: Operating Systems

Fall 2013, Profs. Sirer and van Renesse

Miniproject: malloc() and free() implementation FAQ

Q1

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.

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

Tips

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

© 2013, Cornell University