Amazon interview question

How does malloc work in C? How does deadlock prevention work in operating systems?