Skip to content

A multithreaded parallel grep runner program written in C

Notifications You must be signed in to change notification settings

ni-lie/Linux-based-parallel-grep-runner-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Linux-based parallel grep runner in C

A multithreaded parallel grep runner program written in C that divides the workload of searching through all file contents in a directory tree among parallel threads

Sample Run

Consider the list of directories and files in the image below

directory

We have the following:

  • walkthrough
  • dir1
  • dir2
  • dir3
  • dir4
  • dir5
  • 5 absent text files with contents that do not contain the string 'cs140'
  • 1 present text file with content that do contain the string 'cs140'
String to be searched for: cs140

Shown in the image below is the content of present.txt

present

Running the following in the command line:
./multithreaded 3 /media/sf_cs140/cs140221project2-w-coronel/walkthrough/ cs140
Command line arguments:

  • argv[0]: ./multithreaded
  • argv[1]: 3 (number of workers/threads)
  • argv[2]: /media/sf_cs140/cs140221project2-w-coronel/walkthrough/ (path)
  • argv[3]: cs140 (string to be searched for)

We get the following output:

present

As we can see from the screenshot above, the program outputted one PRESENT, five ABSENTs, and six DIRs.
Moreover, we can see the number of workers/threads that did the process of searching

About

A multithreaded parallel grep runner program written in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages