Wrike Interview Question

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