Skip to content
Snippets Groups Projects
Select Git revision
  • a60b4c57078e17d5ecabf1ac92faa92ca5aab1c3
  • main default
2 results

questions.md

Blame
  • jl4589's avatar
    Joey Le authored
    03799468
    History
    questions.md 2.65 KiB
    1. Can you think of why we use fork/execvp instead of just calling execvp directly? What value do you think the fork provides?

      Answer: fork allows them to run at the saem time so the parent process doesn't stop

    2. 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.

    3. 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.

    4. 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

    5. 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

    6. 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

    7. 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

    8. 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