Computer Sciences Dept.

CS/ECE 354 Machine Organization and Programming

Fall 2008 Section 1
Instructor Mark D. Hill
TAs Mark Liu & Somayeh Sardashti

Optional Assignment 0 // Not Due -- Do Well Before Assignment 1

Send e-mail questions to Mark Lui, mliu@cs.wisc.edu

Purpose

This assignment is intended to give experience using a Unix operating system. Knowing how to work within a Unix environment is a valuable skill, and one that is likely to be needed in further CS classes. Please do not assume that you will get by in this class doing assignments using a Windows system, copying as necessary to turn in assignments.

Statement

All work for this assignment is to be done on one of the department's instructional Unix machines. For this class, please use an emperor machine (in room 1350 CS&S) or a adelie, humboldt, or macaroni machine (in room 1370 CS&S).

This assignment requires you to use several different software tools, including a C compiler, web browser, and an editor, to obtain answers that are placed in a file. Do the following 3 items:

  1. We have written a little C program for you. You need to copy the program, compile the program, modify the program (to fix the error), and then recompile and run the program. Make note of the compiler's output as well as the corrected program's output. The program source code is in the file
    /p/course/cs354-common/public/bin/a0.c
    (C language source code programs end with the suffix .c by convention.)
    1. Copy the file to your own directory. You will want to understand the directory structure, and make a new directory for 354 programs within your private directory.
    2. Compile the copied file (a C program). For information about how to compile, read further under Notes below.

    On purpose (to require you to edit the file!), this program contains an error. Make note of the compiler error you receive. Then, use an editor to correct the program. Compile the corrected program, and then run the program, making note of the program's output.

  2. Almost everything you need to know about CS/ECE 354 is posted on the course web page. You need to run a web browser, find the course home page, (Note: you've already done this, to find this assignment!) and make note of the TA names and office hours.
  3. Look at the questions given in the file
    /p/course/cs354-common/public/html/homeworks/a0.questions
    Record your answers to these questions in a file (using an editor).

Once you have done these 3 things, use an editor to add the following information to your file containing the answers to the questions. Add the C program's compiler error, the C program's corrected output, and the TA names and office hours. Also, place your name, section number, and student ID at the beginning of the file. This file is the end result of the assignment. It is what would have been turned in for this assignment.

Notes

  • To compile a C program, use a C compiler. cc is fine for this assignment. If the name of the C source code program were myprogram.c, then the Unix command
    cc myprogram.c
    will compile this program, placing the executable program in the file a.out. Note that this command (given in this manner) must be executed while your current working directory (often abbreviated cwd) is the one containing the C source code file. To place the executable in a file other than a.out, add another option and argument to the command line:
    cc myprogram.c -o executablename
  • To run a program (any program!), use the name of the program as the Unix command. For example, if you compiled with the command
    cc myprogram.c
    (and there were no compiler errors), then the executable is in a file named a.out. To execute the program, a.out becomes the Unix command.
  • At various times while working on this assignment, you will need to use an editor. You may use any editor you like. Common choices are emacs, vim or gvim, and pico.

Handing In the Assignment

We will be using the CSL-supported handin scripts to turn in assignments online. This optional assignment will not be turned in.

 
Computer Sciences | UW Home