Skip to content
Snippets Groups Projects
Commit 383def34 authored by cxb23's avatar cxb23
Browse files

added questions.md file

parent ea9272dc
No related branches found
No related tags found
No related merge requests found
### 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:** It makes it easier.
### 2. What happens if the fork() system call fails? How does your implementation handle this scenario?
**Answer:** End the child process and print and erro message.
### 3. How does execvp() find the command to execute? What system environment variable plays a role in this process?
**Answer:** I don't know.
### 4. What is the purpose of calling wait() in the parent process after forking? What would happen if we didn’t call it?
**Answer:**
### 5. In the referenced demo code we used WEXITSTATUS(). What information does this provide, and why is it important?
**Answer:** Th exit status of the child processes. It's important to know whether they failed or not and how.
### 6. Describe how your implementation of build_cmd_buff() handles quoted arguments. Why is this necessary?
**Answer:** It specifically loops until it finds a quote, then copies what's inbetween the quotes, and then moves on. This is important because otherwwise, you could run into the problem of splitting the cmdline into arguments in a way that wasn't intended.
### 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:** I didn't use strtok becasue it wasn't as necessary.
### 8. For this question, 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:** Signals send instructions to processess. Thye are different than other forms of IPC because they are asynchronous.
### 9. Find and describe three commonly used signals (e.g., SIGKILL, SIGTERM, SIGINT). What are their typical use cases?
**Answer:** SIGKILL: immediately stops a process, used to forcefully kill a process; SIGTERM: "asks" a process to stop, used to get a program to close properly; SIGINT: interupts a process, used to stop a process running in the terminal
### 10. What happens when a process receives SIGSTOP? Can it be caught or ignored like SIGINT? Why or why not?
**Answer:** When a process receives a SIGSTOP, it pauses its execution. It cannot be caught or ignored.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment