About this question
Medium · concurrency · Quant Developer interview question · state-machine, hash-table, simulation, c++
In high-frequency trading (HFT), outbound connections to an exchange must be strictly limited to avoid penalties or disconnections. A common approach to throttle concurrent orders is using a counting semaphore to manage connection slots and queue waiting orders. Simulating this behavior ensures deterministic testing of order flow management systems across multiple exchanges. Task Implement a ConnectionThrottle class to simulate a counting semaphore for multiple exchanges. - ConnectionThrottle(