CMPSCI 377: Operating Systems
Discussion 2: OS Design and System Calls


Reminders:

  1. TA Office hours are 11:00AM to noon every Tuesday and Thursday.
  2. Remember submitting your Lab0 to moodle no later than next Monday.

Links:

  1. Slides from discussion: slides.pdf
  2. Discussion questions and solutions
  3. Code to the C fork program which we will walk through: fork1.c, fork2.c, and fork3.c.
  4. Code to the Java exec program we discussed in the context of fork: ExecTest.java. Recall that we discussed how you can use use the fork call (which creates a new process) and the exec call (which transforms the current process into a different program, like hostname in the previous example) to implement the command execution framework of Runtime.exec() in Java.

    In fact, using a combination of fork and exec is how most command line shells (e.g., Bash) are implemented. See this page for a good reference on Unix system calls - in particular, I'd recommend reading the (very brief) section on fork and wait. Just following those sections is an example of implementing a simple shell program using fork, exec, and wait.