questions.md

-
Can you think of why we use
fork/execvp
instead of just callingexecvp
directly? What value do you think thefork
provides?Answer: fork allows them to run at the saem time so the parent process doesn't stop
-
What happens if the fork() system call fails? How does your implementation handle this scenario?
Answer: if fork fails then we just ask for new input and it just stops the child input and nothing really happens.
-
How does execvp() find the command to execute? What system environment variable plays a role in this process?
Answer: it finds them in the PATH environment variable.
-
What is the purpose of calling wait() in the parent process after forking? What would happen if we didn’t call it?
Answer: Wait allows the child process to complment so that the process wouldn't turn into a zombie
-
In the referenced demo code we used WEXITSTATUS(). What information does this provide, and why is it important?
Answer: It gets the exit status of the child
-
Describe how your implementation of build_cmd_buff() handles quoted arguments. Why is this necessary?
Answer: It treats them as a whole argument and doesn't ignore the space. So that the whole quote goes in at the same time in one arg
-
What changes did you make to your parsing logic compared to the previous assignment? Were there any unexpected challenges in refactoring your old code?
Answer: Yeah, there was a whole lot to change from the ground up, but I think it's easier to read and more straightforward now
-
For this quesiton, you need to do some research on Linux signals. You can use this google search to get started.
-
What is the purpose of signals in a Linux system, and how do they differ from other forms of interprocess communication (IPC)?
Answer: They allow for more processes to run efficently, and are efficent and can be used a timer and terminate each other
-
Find and describe three commonly used signals (e.g., SIGKILL, SIGTERM, SIGINT). What are their typical use cases?
Answer: SigKILL immediate kills it no mercy. SigTerm asks to terminate itself, and SigInt is when the user process Ctrl + C
-
What happens when a process receives SIGSTOP? Can it be caught or ignored like SIGINT? Why or why not?
Answer: SigStop pauses it, and I think that it can't tbe ignore and just forces it to pauses