CS520
Machine Organization and Assembly Language Programming
Fall 2017


Instructor
Teaching Assistants
Catalog Description
Course Goals
Video Lectures
Course Schedule
Suggested Readings
Disability Services
Emotional or Mental Health Distress
Grading
Policy on Cheating
Computer Accounts
Course Site on Piazza

Instructor

P. Hatcher
Office: Kingsbury N215B
E-mail: pjh@cs.unh.edu
Office Hours: Tue/Thu 9-9:30, 11-11:30, and 3-3:30; or by appointment (send e-mail to request an appointment).

Teaching Assistants

Catalog Description

Assembly language programming and machine organization: program and data representation; registers, instructions, and addressing modes; assemblers and linkers. Impact of hardware on software and software on hardware. Historical perspectives.

The corequisite 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.

Video Lectures

The lectures for this course will be presented in person during the Tuesday and Thursday sessions. However, video lectures used in previous semesters are still available and are linked from the course schedule. There will be in-person lectures that cover new material, but much of the material covered will also be covered by the available video lectures.

Note that the slides for each video 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.

I strongly encourage you to attend the in-person lectures and use the video lectures as a supplement. The give-and-take with students in the live session can be very valuable, especially if you are active in class and ask questions. So, come to the lectures and actively participate!

Course Schedule

Suggested Readings

There is no required textbook for this course.

On reserve in the Kingsbury library:

The readings given in the class 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 or lab. 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.

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

You can get on-line access to other C references via the UNH library's license for Safari Tech Books. Once in Safari, search for "Programming in C".

You will 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.

Disability Services

According to the Americans with Disabilities Act (as amended, 2008), each student with a disability has the right to request services from UNH to accommodate his/her disability. If you are a student with a documented disability or believe you may have a disability that requires accommodations, please contact Student Accessibility Services (SAS) at 201 Smith Hall. Accommodation letters are created by SAS with the student. Please follow-up with me as soon as possible to ensure timely implementation of the identified accommodations in the letter. I have an obligation to respond once I receive official notice of accommodations from SAS, but am under no obligation to provide retroactive accommodations.

For more information refer to www.unh.edu/studentaccessibility or contact SAS at 603.862.2607, 711 (Relay NH) or sas.office@unh.edu.

Emotional or Mental Health Distress

Your academic success in this course is very important to me. If, during the semester, you find emotional or mental health issues are affecting that success, please contact Psychological and Counseling Services, which provides counseling appointments and other mental health services.

Grading

Course grades will be assigned in the following manner:

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.

Labs are due no later than 12noon on the Sunday after the lab. No late submissions will be accepted for labs. (Please note that being one minute late is considered late.) To be successful with the labs, you must start them prior to the lab session. Come to lab to get any questions answered and to finish the lab, not to start the lab.

Attendance in the lab is not mandatory. Your lab will be graded simply by how well your lab submission performs.

The programming assignments are:

  1. Translate between UTF-8 and UTF-16: due September 13.

  2. Emulate converting between IEEE single-precision and double-precision: due September 27.

  3. Disassembling RISC-V object code: due October 11.

  4. Implement threads, mutexes and condition variables on a single core: due November 1.

  5. Implement a concurrent buffer facility, and a multithreaded application that uses it: due November 15.

  6. Implement a multi-CPU cache memory simulation: due December 6.

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 Wednesday. Assignments are due at noon on the day they are due, (Please note that being one minute late is considered late.) Assignments may be handed in late at a penalty of 10 points for one day late and 30 points for two days late. No program may be turned in more than 2 days late.

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 Tuesday October 17. The midterm is closed book and notes.

The final exam will be on Tuesday December 12, 10:30am-12:30pm, Kingsbury S145. The final exam will be comprehensive. The final exam is closed book and notes.

Final course grades will be assigned in the following way:

Please note that I do not round percentages up. So, 84.95% is a B+ and not an A-.

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.

Computer Accounts

The UNH CS server agate.cs.unh.edu is the primary computing resource 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 on agate.cs.unh.edu.


Last modified on November 10, 2017.

Comments and questions should be directed to pjh@cs.unh.edu