Microsoft interview question

What is mutex lock , semaphore ? Write the code for solving dining philosophers problem using locks.