CSCI 320 - Operating Systems & Concurrency
Spring 2019
Rust Assignment #2
Implement the following shell commands as Rust programs:
-
findtext
(5 points): Output every line that contains a specified pattern. The first command-line argument is the fixed-string pattern. Remaining arguments are the names of the files to inspect.
-
webget
(5 points): Fetch the file at the specified URL, and save it as a local file.
-
order
(5 points): Works like cat
, except the output lines must be sorted before being output. All lines from all files will be mixed together and then sorted. If the "-r" command-line argument is provided, they should be sorted in reverse order.
-
processes
(5 points): This program gives
information about CPU processes. Use the
/proc file system view of the
kernel to obtain this information.
- With no arguments, it yields a list of all current processes. This should include the command-line invocation for each process.
- With -r, it yields a list of all running processes.
- With -s, it yields a list of all sleeping processes.
- With -u, the list should be in descending order of user time, which should be displayed (in clock cycles). Processes not using any user time should be omitted.
- With -k, the list should be in descending order of kernel time, which should be displayed (in clock cycles). Processes not using any kernel time should be omitted.
- With -v, the list should be in descending order of virtual memory size, which should be displayed (in bytes). Processes without a virtual memory footprint should be omitted.
Grading
The total value of the assignment is 20 points. No credit
will be given for code that fails to compile. Partial credit may be given for
partially working solutions.