Pergunta de entrevista da empresa AMD

What is deadlock? How does semaphore work?