Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Report : Run the following tests and experiments with your program. Use various input files of different sizes (e.g. >100MB). For each input and program,

image text in transcribed

Report: Run the following tests and experiments with your program. Use various input files of different sizes (e.g. >100MB). For each input and program, measure the run-time of the program. Then generate plots from your results answering following questions: With a fix number of input files, how does the run-time of your program change according to the changing input size? How does the run-time change according to the number of matches? How does the run-time change according to the number of input files. Explain your results and come up with conclusions.

In this project, you are supposed to implement a program which will search words provided by the user in a number of input files and will output the matching lines. The programs will be named psearch. They need to take the following command line parameters: an alphanumeric keyword, number of input files (n), input filenames, and an output filename. Number of input files will be greater than or equal to 1 . Each input file is a text file; containing a sequence of lines. All of these lines may contain one or more (alphanumeric) words. A line of an input file matched if the given keyword is found in the line as a separate word. For instance, the keyword "name" appears in "His name is Ali.", but does not appear in "He is named Ali". The output file will contain the matched lines along with the name of the input file that the match is found in, and the line number of the match in the format below: , : . 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 Implement the program using threads. Instead of creating children processes, create one thread per input file. Each thread will add the matching line information to a shared (global) linked list. When all threads end, the main thread will process the linked lists and will write the output file in the above format. Take care of any possible synchronization problems (use semaphores). You need to use POSIX Pthreads library

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions