Wrike interview question

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