CSCI 311 Test 1 Spring 2017
- The weight for each question is given with the question.
- Use as much paper as you wish, but make your answers are legible.
- Your answers should reflect time spent studying the subject.
- When asked for code snippets, give variable declarations (when appropriate) but do not include (unless specified)
- Header files
- main routine
Simply provide sufficient code to illustrate the concept.
- (6 points) Name and describe three distinct tasks performed by the linux kernel.
- Program Kernel Interaction
- (3 points) What is a system call?
- (2 points) What is a library function?
- (2 points) Give an example of a system call and a library function. Label each clearly.
- Errors.
- (2 points) How can a programmer determine if an error has occurred during a system call?
- (3 points) What utilities exist to help the programmer communicate to the user the error that has occurred during a system call.
- (8 points) There are four basic system calls associated with performing file I/O. Name and describe each.
- (3 points) Describe the actions performed by int dup2(int oldfd, int newfd);
- I/O Redirection.
- (2 points) Describe what the following command does at the I/O level who | more
- (4 points) Draw a diagram showing the execute of these programs, including the shell, over time. Include labels such as fork, exec, and wait. Also include the process names.
- (6 points) Provide the code, including system calls, which the shell might use to accomplish the above task. You do not need to have the parameters to the system calls completely correct.
- (2 points each)The File System
- How could two processes have the same file descriptor pointing to the same entry in the open file table?
- How could one process have two different file descriptors pointing to the same entry in the open file table.
- How could two processes have different file descriptors pointing to different entries in the open file table, yet point to the same entry in the inode table?
- (1 point each) Name three different types of files on the linux file system.