Pergunta de entrevista da empresa EarnIn

How would you implement a mutex from scratch?