a C++ program that creates “nthreads” (number of child threads from… a C++ program that creates “nthreads” (number of child threads from the input). Each child thread must print a message into STDOUT based on the following rules: You will assign a thread number to each child thread based on their created order. The value for the thread number must start from zero and be increased by one before assigning it to the next child thread. You must guarantee that the first child thread has a thread number equal to zero, the second child thread has a thread number equal to one, and the nth child thread has a thread number equal to n -1.Each child thread will print a predefined message (available in the template file). The print statement executed by the child thread cannot be inside of a critical section.Your program must guarantee that messages are printed in the order specified by the “turn” array. For nthreads = 5, and a turn = {3,1,0,4,2} the expected output is:I am Thread 3 I am Thread 1 I am Thread 0 I am Thread 4 I am Thread 2 NOTES You must create n child threads (where n is the value that your program receives from STDIN).You can only use POSIX semaphores, pthreads mutex semaphores, or pthreads condition variables to achieve synchronization (A penalty of 100% will be applied to solutions using mechanisms other than the synchronization mechanisms listed before).A penalty of 100% will be applied to solutions that do not assign the “threadNumber” based on the specifications of the question.Programs not compiling will receive a penalty of 100%.To simplify your solution, the template file defines several global variables that you are allowed to use in your program for this programming question. However, remember that you should avoid using global variables when writing programs.#include You will get a plagiarism-free paper and you can get an originality report upon request. All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades How it works
Will the writer plagiarize my essay?
Is this service safe?
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more