COMS W4118 Spring 2008: Homework Assignment 1
Updated Feb 7 2008

Due Tuesday, February 12th at 9:10 AM (beginning of class)

This homework consists of two components: written assignment and programming assignment.  Each is to be submitted via Courseworks.

Both components of the assignment are to be done alone, not in teams.  Discussion is encouraged but collaboration is not allowed.

Written Assignment

Exercise numbers refer to the course textbook, Operating System Concepts with Java. Each problem is worth 5 points.
  1. Exercise 1.3
  2. Exercise 1.10
  3. Exercise 1.11
  4. Exercise 1.17
  5. Exercise 2.3
  6. Exercise 2.4
  7. Exercise 2.8
  8. Exercise 2.14
You should submit your assignment via Courseworks->Class Files->Shared Files. Upload your answers in a single ASCII text file.  The filename should be HW1.<uni>.txt  For example, if your uni is sa3152, your submission filename should be HW1.sa3152.txt

Programming Assignment: Shell implementation

Description

A shell is a piece of software which provides an interface for users. It interprets user commands and executes them. Some shells provide simple scripting terms such as if or while, and allow users to make a program which facilitates their computing life. There are two categories of shells: command line and graphical. Intuitively, command line shells provide command line user interface commonly used in Unix/Linux environments, while graphical shells provide graphic user interface(GUI) such as MS Windows. In this assignment, we will focus on command line shells.

One of the interesting features of shells provided in Unix/Linux is a pipeline:

$ cmd1 | cmd2 | cmd3

This command connects the standard output of cmd1 to the standard input of cmd2, and again connects the standard output of cmd 2 to the standard input of cmd3. Common usages of this feature are ls -al | more or who | wc -l.

In this assignment, you will implement your own shell.

Purpose

Programming Assignment

1. (10 points) Write a simple shell. Basically your shell should read the line from standard input, parse the line with command and arguments, and execute the command with arguments. You should use fork and exec system calls.

2. (20 points) Implement the following built-in commands.

3. (20 points) Extend your shell with pipeline (|).

Special Note - Clarifications

Requirements

You should submit your assignment via Courseworks->Class Files->Shared Files. Post a single archive file including all of your files. The filename should be HW1.<uni>.tar.gz. For example, if your uni is sa3152, your submission filename will be HW1.sa3152.tar.gz.

Make sure that your program compiles and runs correctly on the CS CLIC machines. To grade this assignment, we will extract your submission file, type make, and run myshell.

References