TWiki> CS361fall13 Web>Homework1 (revision 1)EditAttach

Homework 1: Getting Started, and Analyzing Dynamic Memory Usage

This homework has two main parts. Part one is making sure you are able to log into your Amazon EC2 virtual machine, as well as checking out the homework template from svn, and committing files to your turn-in repository.

In step 2, we do a little bit of analysis of dynamic memory usage by malloc and the stack.

Getting Started with Amazon EC2

You should have received two emails by now, one with your Amazon AWS credentials, and one with your turn-in subversion repository credentials. If you did not receive these, check your spam folder. If it's not there either, contact Jakob immediately.

While you are free to use any linux machine for your homework projects, you have been provided with a free Amazon EC2 virtual machine, which provides a consistent and reliable environment to work with. All grading will be done using this platform, so to be safe, you'll probably want to use it to test your programs as well.

Follow this link and instructions provided in the Amazon credentials email to start your virtual machine. If you can't find your VM in the list, try switching the "zone" in the top right corner to "N.Virginia".

Then log into it using ssh from your computer. Attached to the email was a file named id_rsa, use that as the private key or identity file when logging into your VM. Your username for the ssh login is "ubuntu". There is no password (the id_rsa file is used instead of a password).

You'll want to install some programs on your VM. To get the essentials, run these commands:

sudo apt-get install build-essential sudo apt-get install subversion

Getting Started with Subversion

For this class, we use the subversion revision control system to handle homework templates and turn-ins. Every student has their own individual turn-in repository, where you are expected to commit your homework solutions. There is also a shared repository, at svn://, which contains class materials such as homework templates, previous homework solutions, drawings from lecture, etc.

To check out your personal turn-in repository, which will be empty at this point, go to the directory where you would like the new repository folder to appear. Then type

svn checkout svn:// --username USERNAME

where USERNAME obviously is your svn username. This creates a folder called USERNAME, with a hidden .svn folder inside it.


below here is still a draft, please do not check out the homework template just yet as it will change

To check out the first homework template, cd to this folder, and type (pay attention!)

svn export svn://

note that it says export, not checkout. This is a very important detail: never use checkout to get your homework template. It'll cause you (and us) all manner of headaches.

This creates a new folder called hw1. To commit the template as your homework solution (you actually get points for this, this time only!), type

svn add hw1

to tell subversion that hw1 is a folder (including its current contents) that svn should keep track of for you. Then, type

svn commit -m "my very first commit"

to tell svn that this version of the folder is something svn should remember. Note that every new file or folder that you want to have in your repository needs to be "added" once, and every version you want to store needs to be "committed". svn does not add files or commit versions for you automatically.

Dynamic Memory Usage Diagnostics

The template provides a couple of small programs that allocate memory according to different patterns. These programs periodically call the function check_memory() which, at the moment, does nothing useful at all. Your job is to change check_memory() so that it produces the following output on stderr.

  • heap segment size: total size of the current heap segment in bytes
  • number of allocated malloc() chunks on the heap.
  • number of free malloc() chunks on the heap.
  • total bytes in allocated chunks.
  • total bytes in free chunks.
  • current stack size: total number of bytes used by the stack at present, not counting the frame for check_memory(). Note: this is not the segment size, just the current stack size.

The output format should be space-separated decimal numbers on a single line per call to check_memory().

Turn-in instructions

To prove that you got subversion working, you just have to commit the hw1 template to your personal turn-in repository following the instructions above.

To prove that you got your EC2 instance up and running, and that you logged in successfully, copy-paste the output of the following two commands to a file called "EC2.txt" in your hw1 directory.

uname -a who

Don't forget to svn add EC2.txt and =svn commit" with a message, to complete the turn-in.

Finally, commit your updated homework template, producing the correct output, to receive the full score on this homework.

Edit | Attach | Print version | History: r5 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2013-08-28 - 15:50:16 - Main.jakob
Copyright 2016 The Board of Trustees
of the University of
Helping Women Faculty Advance
Funded by NSF