CSCI 350 Fall 2001 Quiz 1

Statistics:

mean     40.682 (895.000/22)
stddev   5.957
median   41.000
midrange 36.000-45.000
  1. In a Unix system, what is the purpose of the shell program?

    The shell program's purpose is to interpret commands typed by the user and execute the desired executable files.

  2. Why must cd be implemented as a shell built-in, instead of being a separate executable command?

    A process cannot directly modify the state of another process, but executable commands run in separate processes from the shell and cd's purpose is to change what the shell's process thinks of as the current working directly. Hence cd cannot be implemented as a separate command and must be built into the shell.

  3. Give an example of a situation where the execve() system call might return with an error code.

    I'll give you several situations.

    • There is not enough memory to allocate to the desired executable file.
    • The user does not have permission to access the directory in which the command lies.
    • The user does not have permission to execute the requested executable file.
    • The command's file does not exist.
    • The executable file is not formatted in a manner compatible with the operating system.