Quiz 1 preparation

There are two possible sources of questions:

At this point in the class, most questions on the quiz will of necessity be definitional. Here are some examples. I'll ask at least one question from among the following.

  1. What is the function of the shell in Unix?

  2. What distinguishes a system call from a library function?

  3. What system call generates a new process? What arguments does it take? What does it return?

  4. What does the exit() system call return?

  5. When a process executes execve(), how does the process change?

  6. Consider the following C program.
    #include <stdio.h>
    #include <unistd.h>
    #include <fcntl.h>
    
    int main(int argc, char **argv, char **envp) {
        int fd;
    
        close(1);
        fd = open(argv[1], O_WRONLY | O_CREAT, 0600);
        printf("%d\n", fd);
        return 0;
    }
    
    Say the user runs a.out outfile. Assuming that close() and open() successfully complete, what does this program accomplish? Explain why.