Pergunta de entrevista da empresa Everpure

How does locking work with semaphores?