Create N threads where thread i prints the number i (1 to N). The output must be 1, 2, ..., N, 1, 2, ..., N repeating, so threads take strict turns. Use semaphores for the hand-off. Follow-up: solve…
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.