Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Unix grep program finds lines that match a regular expression. Implement a java version of grep. Make this implementation run faster by running it

The Unix grep program finds lines that match a regular expression. Implement a java version of grep. Make this implementation run faster by running it in a multithreaded way. Split each input file into two equal-sized regions, and look for instances of the regular expression in each region, in a separate thread. The second thread should not output any lines until the first thread is done; instead, it should simply record the matching lines internally, so that it can operate in parallel with the first thread, and wait until the first thread is done before outputting anything based on its records. If an input line straddles the boundary between the two regions, or begins at the very start of the second region, the first thread (and not the second thread) should output the line. Measure the performance of the original Java grep (non-parallel), compared to your modified (parallel) version, and compare both to GNU grep. If you have access to the Unix environment you may run the grep command as follows: LC_ALL='C' time grep -n 'word to find' /path/to/file/abc.txt This will print the timing for you You may add timings directly in your java code in your main method (beginning and at end of scope) Make sure your JAVA versions expect command line args in same format as the grep command does (shown above). For now, only the above type of args need to be handled

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

Step: 3

blur-text-image

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 Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago