Apple interview question

Special case of malloc implementation. Implementing a spinlock, etc.