CS520
Assembly Language Programming and Machine Organization
Spring 2014


Instructor: P. Hatcher
Office: Kingsbury N215B
E-mail: hatcher@unh.edu
Office Hours: Mon 12:30-1pm; Wed 10-11am and 12:30-1pm; Fri 10-11am and 12:30-1pm; or by appointment (send e-mail to request an appointment).
(Please note that I get out of my other class at 12:30pm on MWF so I may be late getting back to my office if I get a lot of questions after class.)
Weekly Help Session: Thur 12:40-2pm, Kingsbury N233.

Teaching Assistant: Andras Fekete
Office: Kingsbury W240
E-mail: afekete@wildcats.unh.edu
Office Hours: Tue 1-2pm.

Class Meeting Times

Section 01:

Section 02:

Section 03:

Section 04:

The lectures for this course will be presented via YouTube videos. My goal for the lectures is to give the impression that I am working just with you, one-to-one. The videos will be low-key and low-tech. Me just explaining the concepts to you.

The class will meet in person once per week for recitation with me and once per week for lab with the teaching assistant. The schedule below indicates which videos you need to watch for each week. Of course, it is critical you follow this schedule and bring up for discussion any questions that arise from the lectures. This style of course provides you more freedom over your time, but places more responsibility on you to manage that time.

Note that the slides for each lecture are available. These slides can serve as a table of contents for the lecture, allowing you to jump into the middle of the video to review a specific topic, for example. In addition, I made a few errors when recording the lectures, such as saying one thing and writing something else. These errors are corrected on the slides. Therefore it is important that you review the slides while watching the videos.

We will use Piazza so you can bring up your questions in real time. You should receive an invitation to join the Piazza class for CS520. If you do not receive an invitation, please contact me.

There will also be an optional session on Thursdays, 12:40-2pm, in Kingsbury N233. I will be there at 12:40 and, if there is anybody there, I will do whatever you want: answer questions, work problems, repeat the lecture highlights, etc. I will not cover any new material in this session.

Prerequisite Course

The prerequisite for this course is CS515.

Course Goals

The key goals for the course are to understand program and data representation, to become familiar with assembly language, machine language and C programming, to understand the impact on software of basic computer architecture concepts such as the memory hierarchy, and to study fundamental system software such as assemblers and linkers. There is also a focus on multithreaded programming.

I was kind of freaked out when I realized that there are people graduating with CS degrees who'd never written C. They started in Java and they stayed there. That just seemed bizarre and wrong. —Jamie Zawinski, early Netscape/Mozilla developer, quoted in Coders at Work: Reflections on the Craft of Programming by Peter Seibel.

I see people that are really smart—I would say they're good programmers—but say they only know Java. The way they think about solving things is always within the space they know. They don't think end-to-end as much. I think it is really important to know the whole stack even if you don't operate within the whole stack. … In practice, nothing works. There are all these beautiful abstractions that are backed by sh*t. The implementation of libraries that look like they could be beautiful are sh*t. And so if you're the one responsible for the cost of buying servers, or reliability—if you're on call for pages—it helps to actually know what's going on under the covers and not trust everyone else's libraries, and code, and interfaces. —Brad Fitzpatrick, creator of Livejournal, quoted in Coders at Work: Reflections on the Craft of Programming by Peter Seibel.

Notice

The University is committed to providing students with documented disabilities equal access to all university programs and facilities. If you think you have a disability requiring accommodations, you must register with Disability Services for Students (DSS). Contact DSS at (603) 862-2607 or visit them in MUB 118. If you have received Accommodation Letters for this course from DSS, please provide me with that information privately so that we can review those accommodations.

Course Schedule

  • week of January 20

  • week of January 27

  • week of February 3

  • week of February 10

  • week of February 17

  • week of February 24

  • week of March 3

  • week of March 10

  • week of March 17

  • week of March 24

  • week of March 31

  • week of April 7

  • week of April 14

  • week of April 21
  • week of April 28

  • week of May 5

    Readings

    The readings given in the above schedule are highly recommended but not required. They are intended to supplement the lectures. Everything you need to know for an assignment or an exam will be covered in lecture, recitation or laboratory. However, the readings will provide a second presentation of most of the material for the course, in case you find things confusing. For most people, seeing the material twice is very helpful.

    Grading

    Course grades will be assigned in the following manner:

    Recitation sessions will be used for active learning. The students will be organized in small groups and each group will work at its own whiteboard. A grade will be given to each student based upon attendance (50%) and participation (50%).

    Each programming assignment will have two labs associated with it. In general, the purpose of the labs is to encourage you to start the assignments early, and work on them steadily. It is very difficult to do the programming assignments in this course at the last minute.

    Laboratory grades will be based upon attendance and correctness of your laboratory submission. If you attend all of the lab, you will receive 50% of the lab points, with the other 50% being awarded based upon the correctness of your submission. If you do not attend, then your grade will be based only upon the correctness of your submission. For example, if you attend all of the lab and you get 70% of the assigned functionality correct, then you will receive an 85% for the lab. But, if you do not attend lab and you get 70% of the functionality, then you will receive a grade of 70% for the lab.

    Labs are due no later than 8am the day after the lab (i.e. at 8am on Tuesday). No late submissions will be accepted for labs.

    The programming assignments are:

    1. Convert UTF-8 to and from UTF-32: due February 6.

    2. Emulate IEEE single-precision floating point addition: due February 20.

    3. Binary translation of vm520 object code to Intel 64: due March 6.

    4. Implement an exception handling mechanism for C: due March 27.

    5. Implement a POSIX threads application: due April 10.

    6. Implement an event loop on the Intel 64: due April 24.

    7. Implement a virtual memory simulator: due May 8.

    The programming assignments must be done in C. We will compile your lab and program submissions using gcc with these flags: -g -Wall -std=c99. Please test using these flags.

    Each programming assignment will be worth 100 points. All programming assignments are due on a Thursday morning at 8am. Assignments submitted between 8am on Thursday and 8am on Friday will be charged a 10% late penalty. Assignments submitted between 8am on Friday and 8am on Saturday will be charged a 30% late penalty. No assignments will be accepted after 8am on Saturday.

    The grading of programming assignments will be based primarily upon demonstrated correct functionality. That is, you will be awarded points for what your program actually does. Some test cases may be public but others will be hidden, so careful testing will be required.

    Points will be deducted from your programming assignment grade if your work is not adequately documented and structured. You must follow the following guidelines:

    In addition, lines should not exceed 80 characters when printed using a tabstop width of 8. It is best to not put tabs in your files. Have your editor automatically expand tabs into spaces. It is also best to use a small indentation amount, like 2.

    If you have any questions about these rules for program layout, see me in advance, not after your first program submission.

    The midterm will be on Wednesday Thursday March 6, 12:40-2pm in Kingsbury S145. The midterm is closed book and notes.

    The final exam will be held during final exam week at a time and place to be determined by the Registrar's Office. The final exam will be comprehensive. The final exam is closed book and notes.

    Students receiving at least 55% of the course points are guaranteed at least a D-. Students receiving at least 65% of the course points are guaranteed at least a C-. Students receiving at least 75% of the course points are guaranteed at least a B-. Students receiving at least 85% of the course points are guaranteed at least an A-.

    Textbooks

    There is no required textbook for this course.

    On reserve in the Kingsbury library:

    The purchase of this book is not required, so the local bookstores will not have it. However, if you want your own copy, they are readily available from on-line retailers.

    You might also want to consult a C reference. My favorite is C: A Reference Manual by Harbison and Steele.

    Also you can get on-line access to C references via the UNH library's license for Safari Tech Books. See the website for the Kingsbury Library for more information. Once in Safari, search for "Programming in C".

    The manual for the GNU assembler may be useful. (In particular, be aware that the syntax used by Intel differs from that used by default by the GNU assembler. See the relevant section of the GNU assembler manual.)

    You may need to use gdb to debug both C code and Intel assembly code. The GNU manual for gdb is here. To debug at the assembly language level, read about the stepi/nexti commands, how to display registers, and how to use the break command with an address.

    If you are serious about building your software development skills, I heartily recommend Coders at Work: Reflections on the Craft of Programming by Peter Seibel. The book contains interviews with fifteen master programmers.

    Computer Accounts

    agate.cs.unh.edu is the primary computing resources for this course. You should automatically be given an account on this machine. During the semester you may use any other machines that you have access to, but for grading purposes your programs must execute correctly on agate.cs.unh.edu.

    Policy on Cheating

    All students are expected to do their own work on all assignments. No collaboration is allowed, either with current or prior CS520 students, or anyone else. One general rule to follow is that you may discuss your programs with other students at the concept level but never at the coding level. If you are at all unclear about this general rule, don't discuss your programs with other students at all.

    Note that this "no collaboration" policy does not distinguish between the "giver" and the "taker". I consider both parties equally guilty.

    In addition, submitting programs that are based upon code retrieved from Internet sources is also explicitly forbidden and will be considered "cheating".

    Be aware that I use tools for automatic plagiarism detection that analyze both current and prior-year assignment submissions.

    Because so much of your course grade is based upon the programming assignments, I will treat cases of cheating severely. If caught cheating on an assignment, you can expect to (at least) receive a failing grade for the course.

    In addition, of course, collaboration is also not allowed on the midterm exam or the final exam.


    Last modified on April 11, 2014.

    Comments and questions should be directed to hatcher@unh.edu