Home CS439

CS439: Principles of Computer Systems

Discussion Section Problem Set 1

Due in Section on Friday, January 24, 2025

The problem set must be completed before section and brought to section. To ensure that your problem set is turned in correctly and that you receive credit for discussion section, you must follow these guidelines exactly.

  1. Open a terminal on a departmental Linux machine. After ensuring that you are in a bash shell, use the time command to measure the time taken by a Linux command that sends output to the screen (and maybe other things as well). You may use any Linux command you like. For instance, a sample run might be (from your project directory):

    time make

    Inspect the output. Explain the meaning of each line. Is the output as you would expect? Why or why not? Include your command in your answer.

  2. Name and briefly describe three OS interfaces.

  3. What differentiates a program, an executable, and a process?
  4. A typical hardware architecture provides an instruction called return from interrupt, which is abbreviated by something like rti. This instruction, which is usually only available while the machine is running in kernel mode, switches the mode of operation from kernel mode to user mode.

    • Explain under what circumstances this instruction would be used by the operating system.

    • What happens if an application program executes this instruction?

  5. Your shell's PATH is a colon separated list of where to find programs to run. On Linux it can be printed out by running echo $PATH.

    Create a toy hello world program, and give it a name of an unimportant executable (like sl) then edit your PATH so that this program is run instead of its real equivalent. How did you change your PATH, and what does this say about the shell picks programs to run based on your PATH?

    Now remove execute permissions from your toy program using chmod -x {program_name}. What happens when you type your programs name into your shell?

    Hint: The following commands temporarly edit your PATH, try running them and note how your PATH changes.

    export PATH=$PATH:{new_directory}
    export PATH={new_directory}:$PATH