Domanda di colloquio di Wrike

When multiple threads access multiple shared resources, how can you prevent deadlocks between them?