Logo

Question preview

Locked up, they won't let me out.

What this preview is

About this preview

Locked up, they won't let me out. is a easy quant interview question on concurrency in Cpp, asked at Defense.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this C++ concurrency question tests

This is an easy concurrency question that probes fundamental understanding of thread synchronization and mutual exclusion in C++. It asks you to reason about the observable behavior of a multi-threaded program—specifically, what gets printed and in what order.

To solve it, you need to understand how locks (mutexes) work, what sections of code run under protection, and how the scheduler might interleave execution across threads. The title hints at a lock being held; the question rewards careful reading of which operations are guarded and which are not. This type of reasoning is essential for writing correct concurrent code in low-latency systems.

  • Mutex and lock semantics
  • Critical sections and mutual exclusion
  • Thread interleaving and race conditions
  • Output buffering and flush behavior