Home CS439

CS439: Principles of Computer Systems

Discussion Section Problem Set 1

Due in Section on Friday, January 23, 2026

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. Name and briefly describe three OS interfaces.

  2. 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?

  3. From Anderson and Dahlin, Ch1 question 1:
    Suppose a computer system and all of its applications are completely bug free. Suppose further that everyone in the world is completely honest and trustworthy. In other words, we do not need to consider fault isolation.

    • How should the operating system allocate the processor? Should it give all of the processor to each application until it no longer needs it? If there are multiple tasks ready to execute at the same time, should it schedule the task with the least amount of work to do or the most? Justify your answer.
      You may assume a uniprocessor.

    • How should the operating system allocate physical memory between applications? What should happen if the set of applications does not all fit in memory at the same time?

    Note: These are thought questions---you are not expected to determine how operating systems currently solve these problems. Instead, you should think about how you would solve the problem.

  4. Given the following piece of code:
                  main(int argc, char** argv)
                  {
                      forkThem(5);
                  }
    
                  void forkThem(int n)
                  {
                      if(n>0)
                      {
                        fork();
                        forkThem(n-1);
                      }
                  }
                

    How many processes are created if the above piece of code is run?

  5. 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.