@@ -6,9 +6,9 @@ _The shell makes sure that it's all complete by calling waitpid() for each child
...
@@ -6,9 +6,9 @@ _The shell makes sure that it's all complete by calling waitpid() for each child
_Closing pipes is very necessary, it will cause memory leaks, and make the pipes open causing it to read forever, and also make sure that the pipline close correctly._
_Closing pipes is very necessary, it will cause memory leaks, and make the pipes open causing it to read forever, and also make sure that the pipline close correctly._
3. Your shell recognizes built-in commands (cd, exit, dragon). Unlike external commands, built-in commands do not require execvp(). Why is cd implemented as a _built-in rather than an external command? What challenges would arise if cd were implemented as an external process?_
3. Your shell recognizes built-in commands (cd, exit, dragon). Unlike external commands, built-in commands do not require execvp(). Why is cd implemented as a built-in rather than an external command? What challenges would arise if cd were implemented as an external process?
I think cd makes it so that the shell directory itself is changed and not the original directory, it wouldn't change our shell, and would be inefficient.
_I think cd makes it so that the shell directory itself is changed and not the original directory, it wouldn't change our shell, and would be inefficient._
4. Currently, your shell supports a fixed number of piped commands (CMD_MAX). How would you modify your implementation to allow an arbitrary number of piped commands while still handling memory allocation efficiently? What trade-offs would you need to consider?
4. Currently, your shell supports a fixed number of piped commands (CMD_MAX). How would you modify your implementation to allow an arbitrary number of piped commands while still handling memory allocation efficiently? What trade-offs would you need to consider?