Question: ( 5 0 % ) Part I: Write a program that reads a given directory ( on the command line ) and searches for files

(50%) Part I: Write a program that reads a given directory (on the command line) and searches for files
that match using some or all of the following:
(10%) If a user enters -name, use the next argument (after name) as the name of the file or
directory you search for
(10%) If a user enters -R, the search should be recursive (not otherwise)
(10%) If a user enters -uid, use the next argument (after uid) as the UID to search for (only select
files owned by the given uid)
(20%) if a user enters -type, use the next argument (after type) as the type of file to search for
(only include files of that given typefor instance regular files, directories, block files, etc.)
(50%) Part II: Write a program that recursively prints out all the full paths of all directories and files in
a given directory that uses forks (the children) to do the recursive methods.
(10%) Each process should print out their directory and all regular files in their directory
(10%) All (children and parents) should contain a program that runs upon its exit, indicating that it
is dying (indicate directory).
(20%) If a directory has a subdirectory, fork a child to recurse into the subdirectory. Note that
means the parent stays in the current directory and the child does the subdirectory call.
(10%) Maintain a counter and make sure not to leave any zombies around... each parent should
wait for its children before exiting.
Extra credit (5%)
Part I: (3%) Create a mechanism for the search to use the size of the file: I want to see It, gt and eq (you)
can use all three at the same time)
Part II: (2%) Consider the performance of Part II. Create a version that doesn't fork and compare the
time it takes to run both... you should run each program several times to ensure accurate results. The
major answer you want to ask,time. "Does adding the fork make for better performance?"
( 5 0 % ) Part I: Write a program that reads a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!