its

CSCI 2330
Introduction to Systems

Bowdoin College
Spring 2017
Instructor: Sean Barker

Project 0 - Unix Warmup and Environment Setup

This project should be completed individually.

This project is designed to introduce and familiarize you with many of the tools that we will be using throughout the semester. Most significantly, this project will teach you the basics of working in a Unix environment, using the command line, and writing and running programs on remote servers. Getting a handle on your working environment early on will save you lots of time in the long run and let you focus on the actual course material of the later projects.

Part 1 - Unix Crash Course

Go through the Command-Line Unix Crash Course. If you have never worked in a command-line environment before, this tutorial may take you some time. If you have some Unix background, you may already have seen most of this material (but you should still at least skim the tutorial to make sure).

A few parts of the tutorial involve short snippets of C code. Don't worry if you've never written any C code before; focus on the conceptual ideas being illustrated (e.g., the process of compilation and the use of command line arguments) and don't get bogged down by the details of C at this point. Don't worry, we'll dive into the details of C later in the semester!

There is nothing to submit for this part.

Part 2 - CSCI 2330 Environment Setup

The Unix tutorial above had you working on Bowdoin's campus-wide Linux machine dover.bowdoin.edu (or, if you're on a Mac or a Linux machine yourself, you may have done the tutorial on your own local machine). However, for the rest of the course, you must use the designated CSCI 2330 server for all projects. Even if the project files appear to compile and run on your local machine, there are subtle differences between Linux and OS X, and between different version of Linux, that may cause hard-to-debug problems. Avoid these problems by always working on the class server (which is also the server that will be used to evaluate your programs)!

In this part, you will configure your account on the class server and then complete a few simple tasks on the server to check your understanding. The main objective here is to make sure all systems issues are resolved now, and not right before the first 'real' project is due.

If you are unsure how to accomplish any of the tasks in this part, your first stop should be the Unix tutorial above. After that, you should consult Piazza, the instructor, TAs, etc.

Accessing the CSCI 2330 Server

The name of the class server is turing.bowdoin.edu. You have been provided an account on this server that will allow you to log in and work on your projects.

Access to the server requires the use of a keypair, which you should have received via email. Your keypair consists of a private key file (named something like username-keypair) and a corresponding public key file (named something like username-keypair.pub). Using a keypair to login instead of a password is (1) more secure, since an attacker could guess your password, but cannot guess your key, and (2) more convenient, since you will not have to type in a password to login. In fact, you do not even have a password associated with your server account - your keypair is the only way you can login.

Keep your keypair safe, as it provides access to your server account. Don't send anyone your keypair file or leave it anywhere publicly accessible - this is like writing your password on a post-it note!

To login to the server using your private key (assuming userid is your username) from either a Mac or a Linux machine, open a terminal window and use ssh to login as follows:

ssh -i userid-keypair userid@turing.bowdoin.edu

Remember to use your actual username instead of userid, and note that the above assumes that userid-keypair is in the same directory from which you are running the command.

If you get an error that references the permissions on your keypair file, you can fix that using the chmod command as shown below, then try running ssh again:

chmod 600 userid-keypair*

If you are logging in from Windows, you can use PuTTY as discussed in the tutorial, but will need to configure PuTTY to use your private key file. To do so, within PuTTY, go to Connection, then SSH, then Auth, then click Browse next to 'Private key file for authentication'. Change the 'Files of type' setting to 'All files', then select your private key file (e.g., username-keypair - NOT your public key file ending in .pub). Now you should be able to login in the usual way to the class server and your private key file will be used.

The server provides a full-fledged Linux environment with all the standard development tools (editors, compilers, version control, etc) preinstalled. If there is any software that you would like to use that is not already installed on the server, please email me.

Checking out your SVN directory

We will use Subversion for storing and submitting all projects. Using Subversion has several advantages: (1) your work will be backed up in the Subversion repository, (2) it will be easy to work in groups later on, and (3) it provides an easy way for me to access your project files, both before and after you have officially 'submitted'.

Each of you has a dedicated directory on Bowdoin's Subversion server for your work in this class, which you and only you can access. Your personal directory is at the following directory (again using your actual username instead of userid):

https://repo.bowdoin.edu/svn/sbarker/cs2330-s17/userid

Login to the class server, then checkout your SVN directory. You can give svn checkout a second argument to specify the name to give the checked-out repository. For example, if your user ID is ghopper, you might run this:

svn checkout https://repo.bowdoin.edu/svn/sbarker/cs2330-s17/ghopper systems-repo

The above command would create a new directory named systems-repo (which is the checked-out repository) in the current directory. Initially, there are no files within your SVN directory, so your checked-out repository will have no files.

Part 3 - Sanity Check

Your last task is to write a very (very!) simple C program, a Makefile for this program, and then check your files into your SVN directory. Within your SVN directory, do the following:

  1. Create a directory called proj0 which will serve as your project folder.
  2. Write a program called like.c that simply prints the message "I like [xyz]!" where [xyz] is the first command line argument. If the program is not given any command line arguments, or is given more than one, it should instead print "What do I like?". For example, if the compiled executable is named like:
    $ ./like pizza
    I like pizza!
    $ ./like Linux
    I like Linux!
    $ ./like
    What do I like?
    $ ./like Linux pizza
    What do I like?
    $
    
    If you've never written a C program before, just use the example in the Unix tutorial as a starting template and modify that -- you don't need any further knowledge of C to complete this part. Your name should be included in a comment at the top of your program.
  3. Write a Makefile for your C program. Your Makefile should have two targets: the default target (which you should call build) which compiles the program into an executable named like, and a cleanup target that deletes the compiled files (here, just the like executable). Follow the Makefile example given in the Unix tutorial.
  4. Once your program is finished, I should be able to run the following set of commands from your project directory to compile your program, run it, and then clean up (at which point I'd need to run make again before I could run the program again):
    $ make build
    $ ./like systems
    I like systems!
    $ make cleanup
    $ ./like systems
    -bash: ./like: No such file or directory
    $ make
    $ ./like make
    I like make!
    
  5. Add your entire proj0 directory to the SVN repository using svn add, then commit your files using svn commit. This constitutes 'submitting' your project. Although you may also make changes later on, the most recently committed files in your SVN directory will be considered your submission. Note that you need not check in your compiled executable to SVN (since this can be immediately regenerated from the source code using the Makefile).

Evaluation

While this project is only a warmup, your submission will be checked based on the following criteria:

  1. Does your program follow the specification above?
  2. Does your program include a Makefile with both the default target and a clean target?
  3. Are all your files checked into your Subversion directory in the proj0 subdirectory?