About this question
Hard · Code Analysis · Quant Trader interview question · concurrency, deadlock, mutex, threading
Consider a multi-threaded trading system. Two threads, A and B, execute concurrently. Thread A first attempts to acquire a lock on mutex mutex1 and then, if successful, attempts to acquire a lock on mutex mutex2. Thread B attempts to acquire locks in the reverse order: first mutex2, then mutex1. What is the most likely outcome if both threads attempt to acquire these locks simultaneously?