Question
Hello I need help writing a c++ program. This project uses fork and pipe. This project creates processes to add all characters ASCII codes in
Hello I need help writing a c++ program. This project uses fork and pipe. This project creates processes to add all characters ASCII codes in a file. The user will enter a number (1, 2, or 4) of parallel child processes and the file (1, 2, or 3) to process. The system will then create this many processes, evenly dividing the file contents between the processes. For example, if the file has 16000 characters and the user wants 4 processes, then each process would process 4000 characters in the file. The main point of this assignment is to compare the results of running a single process vs a multiple process.
The system is illustrated in the diagram shown below. The processes are as follows 1. Parent process. This process allows user to input the number of processes to create (1, 2, or 4). It determines what portion of the file each process works on. More specifically, the first child process handles the first block in the file, and the second child process handles the second one and so on. The parent then waits for each child to report its result. Once each result is received, it combines the results and prints the overall rult. Child process. Process the corresponding block the file. In each block, add each character's ASCII code (http://www.asciitable.com/) and send the total sum back to the parent process through pipe. Avoid using an absolute path in your program. 2. Ci C2 C3 C4 File Description: File 1: 16000 characters File 2: 160000 characters File 3: 1600000 charactersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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