← Paytm questions

Synchronized producer-consumer threads in alternating order

Filed under Paytm

Synchronize n threads (n/2 producers, n/2 consumers) such that producer i produces an item for consumer i, and the execution order strictly alternates: P1, C1, P2, C2, ..., Pn/2, Cn/2.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Paytm questions

Collected from public candidate posts and coding forums. Updated Nov 2026.