Home CS439

CS439: Principles of Computer Systems

Discussion Section Problem Set 1

Due in Section on Friday, January 26, 2018

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

  2. Given the following piece of code:
       main(int argc, char** argv)
       void forkThem(int n)

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

  3. System Calls vs. Procedure Calls: How much more expensive is a system call than a procedure call? Write a simple test program to compare the cost of a simple procedure call to a simple system call ("getuid()" is a good candidate on UNIX; see the man page.) (Note: be careful to prevent the optimizing compiler from "optimizing out" your procedure calls. Do not compile with optimization on.)
    • Explain the difference (if any) between the time required by your simple procedure call and simple system call by discussing what work each call must do (be specific). [Note: Do not provide the source code for your program, just the results].

    Hint: You should use system calls such as gethrtime() or gettimeofday() for time measurements. Design your code such that the measurement overhead is negligible. Also, be aware that timer values in some systems have limited resolution (e.g., millisecond resolution).

  4. Create a name tent for use during all discussion sections this semester. Your name tent must be typed and your first name (or the name you would like to be called) must be displayed in a font size of at least 78pt. Your last name should be on the next line and must be displayed in a font size of at least 48pt. If you are unsure of either what a name tent is or how to create one, many examples can be found using Google (probably the one and only time this semester we will recommend Google). Bring your name tent with you to discussion section (there is no need to turn it in to Canvas).
  5. While holding your name tent, capture a picture of yourself and upload it to the Section 1 assignment in Canvas. The picture must be appropriate, we must be able to read the name tent and see your face, but the rest is up to you.