Reported interview periodMar 2026–Aug 2026
Mode-Compatible Lock with Fair Batching
Implement a lock that may be held concurrently by many threads only when they request the same mode. A different mode waits until all current holders release. Then add fairness across queued modes.
Practice focusRequirements - try acquire grants immediately or queues (tid, mode) without duplicates. - release releases one holder of that mode and returns newly granted thread IDs. - Base lock may admit a new same-mode requester while that mode is active. - Fair lock prevents barging once another mode is queued. - When the next queued mode becomes eligible, grant the contiguous batch already waiting for that mode. - Reject invalid releases and define per-thread ownership. Follow-ups 1. Implement blocking acquire with a condition variable. 2.…