Question
A. It will take the command as input and will execute that in a new process. When your program gets the program name, it will
A. It will take the command as input and will execute that in a new process. When your program gets the program name, it will create a new process using fork() system call, and the new process (child) will execute the program. The child will use the execv() function in the below to execute a new program. Use execv() instead of execvp(), which means that you will have to read the PATH environment variable, then search each directory in the PATH for the command file name that appears on the command line. Important Notes: 1. Using the system() function is not allowed for part A! 2. In the project, you need to handle foreground and background processes. When a process run in foreground, your shell should wait for the task to complete, then immediately prompt the user for another command. myshell: gedit A background process is indicated by placing an ampersand (&) character at the end of an input line. When a process run in background, your shell should not wait for the task to complete, but immediately prompt the user for another command. myshell: gedit & With background processes, you will need to modify your use of the wait() system call so that you check the process id that it returns.
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