Amazon Interview Question

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