Pergunta de entrevista da empresa ASMPT

What method can be used to fix the deadlock problem?