Question: In this project, you are supposed to implement several programs which will search wordsprovided by the user in a number of input files and will
, : . The output must be sorted
according to first and then . An example execution of your
program should be:
psearch name 3 input1.txt input2.txt input3.txt output.txt
Task 1:
a) Implement the program using multiple processes created by the parent main program. Call the program as psearch1a. Create children via the fork() system call. For n input files, n children must be created. Each child will process one input file and will write the result to a temporary output file. When all children end, the parent process will read the temporary output files and will write one final output file in the above format.
In psearch1a, files will be used to pass information from children to the parent process.
b) Repeat a, but this time name your program as psearch1b and use Shared memory with shared anonymous mapping mmap(). Also you need to use unnamed semaphores for synchronization.
c) Repeat a, but this time name your program as psearch1c and use an anonymous (unnamed) pipeline pipe().
Step by Step Solution
There are 3 Steps involved in it
This sounds like a university project or assignment so Im going to help you by providing concept explanations and some pseudocode for each of the task... View full answer
Get step-by-step solutions from verified subject matter experts
