CS-2011 Machine Organization and Assembly Language

B-Term 2017

This course introduces students to the structure and behavior of digital computers at several levels of abstraction. Topics include the functional organization of computer hardware, the functions and operations of assemblers, linkers, and loaders, representations of numbers in computers, basic assembly language instruction sets, addressing modes, and stacks and procedures.

This updated version of CS-2011 was presented in D-term last spring (2017). The textbook is

Randal E. Bryant and David R. O’Hallaron, Computer Systems: A Programmer’s Perspective, 3rd edition, Prentice-Hall, 2016.

The course features four programming projects (i.e., Labs), developed and tested by the textbook authors. The machine and assembly language of choice in this course is that of the Intel-AMD x86-64 architecture. Occasional reference will be made to the 32-bit x86.

During this course, students will manipulate numeric data at the bit level, debug programs in x86-64 machine language, and work on several Lab assignments that expose the inner workings of compiled code.

Note: A copy of this web page appears in Canvas as home page of the course. The information is intended to be identical between the two copies.

Index

Prerequisites
Overview
Goals and Outcomes
Administrative Information

Virtual machine for projects

Office Hours
Grading Policy
Late Assignment Policy

Lecture Notes
Project Assignments (“Labs”)

Lecture notes, Project assignments, Quiz grades, and course resources are provided on Canvas. Lectures for this course will be captured by the Echo360 system, and may also be accessed via Canvas. The Lecture Capture system records the voice of the lecturer, all material projected on the screen from the podium, and a live video of the front of the classroom.


Prerequisites

CS 2011 assumes knowledge of the C programming language and the ability to debug it. This may be a previous Computer Science course at WPI such as CS-2301, CS-2303, or another programming course, project, or job.

Students who are unfamiliar with C are unlikely to be successful in CS-2011. Past experience has shown that there is enough time for students to “pick it up on the fly.”

top


Overview

CS 2011 has three main components:–

·           Programming projects (known as Labs), in which students debug and/or analyze low-level programs that expose the machine-level representation of data and code. Programming assignments are expected to take about 1½ weeks each and will require considerable time and effort outside of the classroom.

·           Lectures, which introduce and discuss the principle concepts of the course, including the representation of numerical and non-numerical data, machine language encoding of common C constructs, and other topics.

·           Recitation sessions, i.e., interactive settings during which students can review and work through class material with the instructors and teaching assistants. This is also an opportunity to get started with programming assignments and to clarify basic issues.

There will be six quizzes during this term. These will be held on Fridays, November 3 thru December 15, 2017. Collectively, the quizzes will represent approximately 40–45% of the grade for the course. The Labs will also represent 40–45% of the grade for the course, and class and recitation section participation is worth 10–20% of the grade for this course.

top

Textbooks

The textbook for this course is

            Randy Bryant and David O’Hallaron, Computer Systems: A Programmer’s Perspective, 3rd edition, Prentice Hall, 2016.

A custom version of the textbook has been ordered for this course. It consists of just Chapters 1, 2, 3, 5, 6, and 7, and it is less costly than the full textbook. For the specified chapters, it is identical to the full textbook. Please contact the WPI Bookstore for this customized version — ISBN 132-331301-X or 978-132-331301-5.

You will also need a reference for the C programming language. Any C textbook will do. The following is inexpensive and (in the professor’s opinion) still the best C textbook available, despite its age.

            Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, 2nd edition, Prentice Hall, 1988.

top

Topics and project in this course

Principle topics of the course are as follows (with textbook chapter references):–

·           Introduction: A Tour of Computer Systems, Chapter 1

·           Representing and manipulating information: including fixed-point and floating-point numbers, arrays, and other data structures, Chapter 2

·           Machine-level representation of programs: Chapter 3

·           Optimizing program performance: Chapter 5

·           The Memory Hierarchy: Chapter 6

·           Linking: Chapter 7

The four Labs (i.e., programming projects) are expected to be:–

·           Datalab: a series of puzzles, each of which is an empty function body that must be completed to implement a specified mathematical function, such as “absolute value.”

·           Bomblab: a binary Linux executable C program comprising six “phases.” In each phase the student must enter a string on stdin. If the entered string is correct, the student gains ten (or sometimes fifteen) points, and the program proceeds to the next phase. If not, the bomb “explodes” by printing “Boom!!!” It also automatically deducts ½ point from the student’s grade for the lab. The goal is for the student to defuse as many phases as possible. Each student gets a different bomb, so that no two are alike.

·           Attacklab: an exercise in attacking (i.e., hacking into) two programs to exploit their security vulnerabilities and to make them do things that they are not programmed to do. As with Bomblab, each student gets a different exploit target, so that no two are alike.

·           CacheLab (or possibly MallocLab or PerfLab): a detailed exercise to develop an understanding of the performance impact of code optimizations.

All four labs are supported by servers on cs2011.cs.wpi.edu. These display students’ scores in real time, so that you can see how you are doing relative to other students.

top

Goals and Outcomes:–

·           Understand the relationship between hardware and software on modern digital computers

·           Understand the binary representations of the numeric data types encountered in programming languages and be able to convert data from one numeric type to another

·           Understand how executable programs are represented in machine language and how data are stored on the stack, in arrays, and in other data structures

·           Be able to test and debug programs at the machine language and assembly language level

·           Become intimately familiar with the use of a debugger

·           Explain the fetch-decode-execute cycle in terms of registers, buses, and memory

·           Describe the assembly and linking processes

·           Explain how cache memory and instruction pipelining can improve computer performance

Uses of a Debugger:–

An essential tool is the course is the use of a debugger. You may use any debugger you wish. The course virtual machine for projects (see below) is equipped with gdb, eclipse, and Nemiver, but you may download and install any debugging tools you wish. When asking for help, please be prepared to show the behavior of your program in a debugger. If you don’t know how to use a debugger, ask for help about that first!

top


About this course:–

Many students report (in course evaluations and other feedback) that this is the most difficult computer science course that they have encountered so far during their student careers at WPI. They also report that they have worked the hardest and that it has been the most fun!

The central parts of learning in CS-2011 are the four Labs. The lectures, recitation sessions, and textbook are in support of those Labs. There is not enough lecture or recitation time to “teach” you how to do everything before we ask you to actually apply it in the Labs. Therefore, it is incumbent on you to start work on the Labs as soon as they are assigned, in order to try to figure out what you don’t know. It is your individual and collective responsibility then to raise the questions with the Professor, the TAs, and each other about what you should be finding out in order to solve the labs.

Quiz questions may include topics that you should have already figured out that you need to know, but that were not necessarily covered in class or recitations. They may also include material covered in the textbook that was not specifically mentioned in class.

top

 


Administrative Information

CS-2011 meets for four one-hour class sessions per week for a seven-week undergraduate term (28 hours).

Time and Place: Mondays, Tuesdays, Thursdays, and Fridays, 9:00 AM — 9:50 AM, Salisbury Labs 115, October 24 to December 15, 2017.

            There will be no class during the Thanksgiving break of November 22-24, 2016.

            There is also no scheduled class on Tuesday, December 12. (This is formally listed on the university calendar as a “reading day” but may be used as a “snow day” if classes are cancelled earlier in the term.)

Recitation Sessions: Recitation sessions will be held on Wednesdays in the Zoo Lab (Fuller A21) at 9:00 AM and 10:00 AM, in Salisbury Labs 123 at 11:00 AM and 12:00 noon, and in Goddard 012 at 1:00 PM. Unless you have made prior arrangements (for example, trading with another student), you must attend the session for which you are registered. There are not enough seats in either room accommodate students who oversleep and then expect to get into a later session.

            Attendance at Recitation sessions is recorded. Students who find the Recitation material too easy are encouraged to help others. If you do help someone else, please let the TAs know so that they can record it for extra credit.

Professor: Hugh C. Lauer
Email: <professor’s last name>@wpi.edu
Office hours: see chart below; or by appointment
Office: Fuller Labs, Room 144

Teaching Assistant:
Salah Ahmed <sahmed2>

Senior Assistants:
Spyridon Anatonados <santonatos>
Saahil Claypool <smclaypool>
Michael Giancola <mjgiancola>
Rachel Plante <rplante>
Timothy Winters <twinters
>
Office hour location for TAs and SAs:– Fuller A22

Class e-mail lists: The following two lists are in the domain cs.wpi.edu:–
cs2011-all  — to reach all students, TAs, SAs, and the professor
cs2011-staff — to reach just the TAs, SAs, and the professor

Course web site: http://web.cs.wpi.edu/~cs2011/b17/
In order to comply with copyright regulations, lecture notes, projects assignments, and most other materials are stored in password protected locations on Canvas. Click on the links in the course website, which will take you directly into Canvas to the correct location.

Absences: Students needing to be absent from class should notify the professor by e-mail or in person as soon as possible. Likewise, students needing to schedule assignments or presentations around religious holidays, projects, or interview trips should notify the professor at the beginning of the course.

top

Virtual Machine for Projects

A virtual machine is provided for carrying out CS-2011 projects. Experience in previous terms indicates that it is far easier on both students and staff if all students use the exact same execution environment. This virtual machine includes a copy of Ubuntu Linux, version 14.04.3 LTS, and it can be run on any desktop or laptop Windows, Macintosh, or Linux system using Virtual Box or VMware Player or VMware Fusion.

Instructions on setting up and using the virtual machine are course website under the Projects protected subdirectory.

If you already have an Ubuntu virtual machine from a previous course such as CS-2303, you may use that. However, you may have to install some debugging tools.

Office hours

See this page for office hours:– OfficeHours.htm

top


Grading Policy

Final grades will be computed as follows:

·         Quizzes: 40-45%

·         Programming projects (i.e., Labs): 40-45%

·         Recitation and class participation: 10-20%

 

Satisfactory completion of programming projects is required for passing this course. Good grades on quizzes alone are not a substitute for doing the Labs and for attending Recitation sessions.

If there are any circumstances that limit or restrict your participation in the class or the completion of assignments, please contact the professor as soon as possible in order to work something out.

Quizzes

In lieu of major exams, there will be a quiz each week at the start of class.

Quizzes will be approximately twenty minutes in length, except the last one will be approximately 40 minutes in length. All quizzes will be open book and open notes. You may use a calculator or a calculator app on your phone, tablet, or laptop. You may refer to textbooks and notes on a laptop or electronic reading device, but you may not connect to any network during the quiz. You may start each quiz as soon as you arrive in the classroom; quizzes will end at a designated time. Therefore, it is in your interest to arrive early and get a little extra time.

If you finish early, please remain quietly in your seat to avoid disturbing your neighbors.

Quiz dates are

Friday, November 3
Friday, November10
Friday, November 17
Friday, December 1
Friday, December 8
Friday, December 15

There are no makeup quizzes. The quiz portion of the grade will be based on your best four of the six quizzes. This policy is intended to accommodate illnesses, religious holidays, absences from campus for any reason, or just plain bad days. If you must be absent from campus on a quiz day, please inform the Professor prior to the absence.

The last (i.e., “final”) quiz is mandatory for passing this course. It will be slightly longer and worth a few more points than the other quizzes. Skipping the final quiz is tantamount to requesting a grade of NR for the course.

Note: It is not in your interested to “take a zero” on the final quiz. For purpose of “dropping the two lowest quizzes,” the final quiz counts as only one quiz, not two.

top

Students with Disabilities

Students with disabilities who believe that they need accommodations in this class are encouraged to contact the Disability Services Office (DSO) as soon as possible to ensure that such accommodations can be implemented in a timely fashion. The DSO is located in Daniels Hall. The Professor must receive requests for accommodations at least one week prior to a quiz.

In normal circumstances, you would report to the Exam Proctoring Center (EPC) before the start of the quiz in class, and then you would return to class at the end of the quiz, to be in time for the lesson in the remainder of the period. Please try to be back in class by 9:20 AM (except for the final quiz).

top

Academic Honesty

Students are strongly encouraged to work together, help each other, reinforce each other’s knowledge, and consult experts and resources outside the course on all topics. Like most professional environments in your future, success depends upon how well you do when you have access to a full array of resources, not how much you remember by rote.

In the course, you may help each other, but you may not copy, retype, or look at each other’s work or any work online or from other sources outside the course.

Once you and your classmates have worked out a solution to a problem, you must write it up in your own words or code it in your own coding style. Some assignments may be team assignments. For these, it is expected that all team members participate with roughly equal levels of effort. When you put your name on a team submission of an assignment, not only are you testifying that you have fully participated in that assignment, but also your teammates are also testifying that you have fully participated.

For all assignments, the WPI Academic Honesty Policy applies:–

http://www.wpi.edu/Pubs/Policies/Honesty/policy.html

Special Note on Bomblab: A year and one-half ago, two students developed an “auto-solver” for Bomblab. Since that time, a new Bomblab has been created as part of a Major Qualifying Project at WPI. This will be the second time the new version of Bomblab has been used in class. Please bring any problems or issues with Bomblab to the attention of the professor and/or the TA’s.

Special Note on course servers: Last year, a student was detected hacking into the course server to gain root access. This constitutes a violation of the university’s Acceptable Use Policy. Violations of the Acceptable Use Policy will be reported to the Dean of Students office and may result in an appearance before the Campus Hearing Board.

top

Submitting Programming Projects and Late Policy

Most programming assignments will be submitted via autograders. However, backup submissions via the Canvas system are required, partly to establish timeliness and partly to protect against assignments getting disconnected from the student in an autograder.

Late programming projects will be penalized 5% of the full value of the project for each hour late up to two hours and then 10% per hour after that.

Unlike some earlier instances of this course, there are no grace periods for late assignments.

No makeup programming assignments will be given. If you have special circumstances, contact the Professor at least 24 hours before the assignment is due.

If a submitted programming assignment fails to compile, the graders will make a good faith effort to contact the student. The student may fix and resubmit the assignment for a 25% penalty within 24 hours. If it is not fixed, the assignment will be graded as zero.

top