Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS3423 Pgm#6 Process Control (40 pts) This assignment involves creating a parallel shell tool called PELL. It provides users of pell with the ability to

image text in transcribedimage text in transcribed

CS3423 Pgm#6 Process Control (40 pts) This assignment involves creating a parallel shell tool called PELL. It provides users of pell with the ability to execute commands, execute multistep processes connected by pipes, and execute concurrent independent processes. PELL supports the following major commands conc cmd1 argsl , cmd2 args2, conc causes PELL to execute the commands concurrently (i.e., in parallel). There is no communication between the commands, these simply happen in parallel. fork each of the children. The maximum number of commands is 5. If any of the commands redirect input or output, you must do the redirection after forking, but before execing. The getCommands function has been provided to simplify the process of getting the command arguments and redirection values Example: conc 1s -1 /bin> 1sOne.txt , 1s -1 /usr/bin > 1sTwo.txt , 1s -1 /etc 1sThree.txt Each of the Is commands are executing in parallel The conc command prints each of the parallel commands showing the parent's process Id child's process ID, the command, and command arguments. Your actual PID values will be different 33009 33011: ls -1 /bin 33009 33012: ls -1 /usr/bin 33009 33013: ls -1 /etc That output is written to stderr to not interfere with stdout. Since there are three commands, PELL has to create three children, (in this example) redirect stdout for each child, and execvp to the particular command for each child pipe cmd1 args1 , cmd2 args2 pipe causes PELL to create a pipe and fork a child for each cmdi. There are only two commands cmd1 can have stdin redirected from a file. cmd2can have stdout redirected to a file You will have to use dup2 to redirect the pipes. Example: pipe ls -1 Data , sort -k5 n sort.out The pipe command prints each step showing a sequence, parent's process ID the child's process ID, and its command 1 33043 33045: 1s-1 Data 2 33043 33046: sort -k5 -n That output is written to stderr to not interfere with stdout Since there are two commands, PELL has to create one pipe, and two children. The pipe is the output for step 1 and the input for step 2 Notes 1. To redirect a file to stdin: open the filename as O_RDONLY dup2 its fd to STDIN_FILENO 2. To redirect a file to stdout: open the filename as OWRONLYIO CREATIO EXCL dup2 its fd to STDOUT FILENO 3. Copy the files for this assignment to your execution directory cp -r /home/bkl740/cs3423/2018Su/Proj6/* . Create a directory named Dout below your execution directory. This will be useful in keeping the output ina separate directory which you can manually clean up easily (rm Dout/*) Instructor provided the following files 4. 5

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

What is Indian Polity and Governance ?

Answered: 1 week ago