Question: C++ Write a program in which a group of 7 threads works. Thread code should be placed in the function. Function parameter is the thread
C++
Write a program in which a group of 7 threads works. Thread code should be placed in the function. Function parameter is the thread number (integer number). Thread displays in the loop 10 times the message "i = number from 0 to 9, number = thread number". After displaying each message thread sleeps for 100 to 500 ms (random value). Synchronize operations on the console (use mutex and lock).
To synchronize operations on the console, use a semaphore instead of a mutex. Limit (also using semaphore) a maximum of 3 threads to execute their loop at a time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
