Question
Implement a closh (Clone Shell) designed to run multiple copies of a program at once. Closh takes as input the name of the program to
Implement a closh (Clone Shell) designed to run multiple copies of a program at once.
Closh takes as input the name of the program to run, the number of copies (processes) of the program to run - an integer from 1 to 9 and whether the processes should execute concurrently or sequentially.
Closh executes the given program the specified number of times, then returns to the prompt once all processes have either completed or timed out. The shell should be written in C++. Use execlp() to create a new child process and have it execute a command and waitpid in the parent process to wait for the child process to finish in case sequential execution is selected.
Here is a simple example of using closh (bold is program output, italic is user input):
./closh
closh> ./hello.exe
count> 3
[p]arallel or [s]equential> p
hello world
hello world
hello world
closh>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started