Here is a general outline of the key concepts and commands (arranged by topic) that you should know for Exam 03.

The exam will have the following format:

  1. Identification: Identify commands, Python function, or system calls that perform certain tasks.

  2. Short Answers: Briefly answer conceptual questions about document tools, Python, and system calls.

  3. Debugging: Fix some Python scripts that use system calls.

  4. Programming: Write some Python scripts that use system calls.

Filters

Concepts

  1. How would you use awk to:

    1. Extract all the values from the Nth field of a CSV file?

    2. Extract all the unique values from a CSV file?

    3. Compute the sum of all values from the Nth field from a CSV file?

    4. Determine the largest value from the Nth field from a CSV file?

Commands

  1. awk

Document Tools

Concepts

  1. What are the advantages and disadvantages of using command line tools such as pdflatex and gnuplot to create documents?

  2. Given a TSV data file, how would you use gnuplot to produce a line graph in PNG format?

  3. How would you use ImageMagick to:

    1. Convert a PNG image to JPG?

    2. Resize a PNG image?

    3. Create a GIF from a series of PNG images?

Commands

  1. gnuplot

  2. pdflatex

  3. convert

Python

Concepts

  1. How is Python different from the Bourne shell? How is it similar?

  2. How do we manage control flow in Python? How do we utilize these constructs?

    • Conditionals
    • Loops
    • Exceptions
    • Functions
  3. What data structures do we have in Python? What are their basic operations?

    • Lists
    • Dictionaries
    • Sets
  4. How do we process command-line arguments in Python?

    • sys.argv
    • getopt

System Calls: Files, Filesystem

Concepts

  1. What is the difference between user mode and kernel mode? How and when do we transition between the two?

  2. What exactly are system calls? What happens when an application performs one?

  3. What exactly is a file descriptor and what system calls can we do with one?

  4. How is os.open different from open in Python?

  5. How do we get the inode information for a file? Using the inode information, how do we

    • Check if a file is a regular file, directory, or symlink?

    • Check the size of the file?

    • Check the last modification time?

  6. Describe how find determines if a file, directory, or symlink is empty.

  7. Describe different reasons why os.stat could fail on a file.

  8. Given the command ./script.py *.txt, who is responsible for expanding the *.txt into all the files that match that pattern?

  9. How would you print all the files found underneath a directory and all its subdirectories?

Functions / System Calls

  1. os.open

  2. os.close

  3. os.read

  4. os.write

  5. os.lseek

  6. os.stat

  7. os.lstat

  8. os.unlink

  9. os.rename

  10. os.walk

  11. os.access

System Calls: Processes

Concepts

  1. What is a process? What attributes does it have and what system calls can you do with them?

  2. Describe the following components of a process.

    • Memory address space
    • Kernel state
    • Execution context
  3. Describe why a process is viewed as a unit of allocation by explaining the life cycle of a typical process.

    • After a fork, how does a process determine if they are the child or parent?

    • After a fork, who executes first: parent or child?

    • What happens when a process performs exec?

    • Why is it necessary to perform a wait?

    • What is the purpose of exit?

  4. How do we prevent a fork bomb? zombies? Why would we want to prevent these situations?

  5. What is a signal? What does a signal do to a process? How do applications handle signal events?

    • How do we send a signal to another process?

    • How do we catch signals and handle them?

    • What happens to system calls if a signal interrupts them?

Functions / System Calls

  1. os.system

  2. os.fork

  3. os.execvp / os.execlp

  4. os.wait

  5. sys.exit

  6. signal.signal

  7. signal.alarm