Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please do it in C++ only You must complete the program below (using POSIX threads) that creates n threads (where n is the number of
Please do it in C++ only
You must complete the program below (using POSIX threads) that creates n threads (where n is the number of characters to find in the message) to determine the frequency of a set of symbols (string) in a message (string). Each child thread receives the character to search in the message (char), a pointer to the message (string *), and a pointer to store the calculated frequency (int *). This last pointer is a memory location accessible by the parent thread. The program's input is a string representing the set of symbols (characters) to search in the message, followed by another string representing the message. Given the following input: C3 COSC 3360 FALL 2022 - RINCON Three child threads are created: The first child thread calculates the frequency of the character ' C ' in the message. The second child thread calculates the frequency of the character ' ' in the message. And the third child thread calculates the frequency of the character ' 3 ' in the message. The expected output by the parent thread is: Frequencies: C: 3 :5 3:2 Notes: 1. Not using POSIX threads will translate into a penalty of 100%. 2. You cannot modify the structure used to pass the arguments from the parent thread to the child threads. 3. Follow the instructions provided in the template file to complete your solutionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started