CSCI 311 Test 1 Spring 2016


  1. Operating Systems
    1. [3 points] Draw a diagram representing an the relationship between the following terms
      • Application
      • Kernel
      • Library Routines
      • Shell
      • System Call
    2. [2 points] What is the difference between a process and a program?
  2. Shells
    1. [2 points] What is a shell?
    2. [6 points] Name, and define or describe three different tasks performed by a shell.
  3. Command line arguments
    1. [3 points] Describe how command line arguments are provided at the programming level. Give example code.
    2. [3 points] How would a programmer search command line arguments for the flag --verbose? Give example code.
    3. [2 points] Describe the operation of the system call char *getenv(const char *name);
  4. [6 points] There are 7 different types of files on a Unix/linux file system. Name and describe three.
  5. I/O
    1. [3 points] The following code is used to open a file. Describe the purpose of each of the components in this command.
      fd = open("myFile", O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)
      	
    2. [5 points] the following code is used to write to a file.
      1. Give code to detect and report an error due to executing this code.
      2. What situation, other than errors, might the programmer need to handle as a result of this code executing?
      bytesWritten = write(fd, buffer, bufferSize);
      	
    3. [4 points] Describe the result of seeking 1000 bytes past the end of a file and writing data. Does the program crash due to this action and is the data written lost?
    4. [2 points] What happens if the last reference to a file removed (unlinked), while a process still has an open file descriptor referencing that file?
  6. The File System:
    1. [3 points] Describe the following components of the unix/linux file system.
      • File descriptor
      • Open File Table
      • I-node table.
    2. [2 points] Describe and provide an illustration showing how the above portions of a file system are related.
    3. [4 points] Two different processes have open file descriptors which point to the same entry in the open file table. What is the implication of this and how could it occur?