Writing my own malloc with an eye out for multi-core performance as part of an OS university course was one of the funnest assignments I had the pleasure of working on. It's so satisfying to shed yet another layer of magic, and get a thorough understanding on how the fundamentals work.
We did exactly the same thing in my C programming course. Its funny how the best way to learn is to reimplement functions and algorithms that were revolutionary 30 years ago =)