Dalhousie University

CSCI 2122              Systems Programming              Winter 2021


• Instructor: Nauzer Kalyaniwalla, CS 221; 494-2841 [email protected]

• Times: Lecs. M, W 10:00 - 11:30; Lab Sessions: M,W: 1:00 - 2:30; T: 10:00 - 11:30.

• Location: MS Teams. Join Code: d3ect38

• Office Hours: Mon, Thurs 11:30 - 1:00 (Tentative. Changes announced in class)

• Text: Computer Systems: A Programmer’s Perspective. 3rd Ed.; Bryant & O’Hallaron (2016) Pearson. Available electronically at: https://tinyurl.com/yg94dq36 A C reference is useful to have at hand. Several good references are available online: https://tinyurl.com/puqwlqq. (the list is only a suggestion.) A concise guide is at: http://cslibrary.stanford.edu/101/EssentialC.pdf.

• Teaching Assistants:

Robert Smith, [email protected]

Ryam Amaral, [email protected]

Malay Pundlik, [email protected]

Reza Soltani, [email protected]

• Evaluation:

Assignments    ~ 5× 8% each    %40

Test                8%                    (March 1, in class)

Labs               10 × 4%             %40

Final:              12%                   scheduled by the Registrar

• Course Description: The course presents a low level view of computer. This includes tool and techniques for systems programming. To this end, students will be introduced to C and x86-64 assembly. which will also serve as a tool for ex-ploring the computer at a low level. The course also discusses data representations, memory hierarchy and its effects on performance.

• Learning Outcomes:

(i) Data Representation and Assembly: Describe the internal representation of numeric/non-numeric data. (i.e. ints, floats, chars, strings, records, and arrays); Convert numerical data from one format to another; Explain different instruction formats, such as addresses per instruction and variable length vs fixed length for-mats; Explain how subroutine calls are handled at the assembly level; Show how fundamental high-level programming constructs are implemented at the machine-language level.

(ii) C Programming: Explain the C build cycle (preprocess, compile, assemble, link); Use pointers in C and manage memory; Describe the various kinds of soft-ware errors that can occur and their causes; Write a program in C to solve a problem of moderate complexity given a problem specification; Use a debugger to debug an executable program.

(iii) Memory Hierarchy: Learning about the effects of the memory hierarchy on program performance.

• Labs:

To be able to understand and do the labs, you must attend the online labs. The schedule of labs and due dates is available in the Lab Technical Document.

○ All submitted code will be passed through MOSS plagiarism detection software https://theory.stanford.edu/~aiken/moss/. If you do not wish you lab assign-ments to be submitted to MOSS, contact the course instructor.

• General Expectations

You will not necessarily understand the lecture notes unless you attend the lecture.

○ If you don’t understand something, please ask, either at the lecture, after/before the lecture or the office hours.

○ Assignments are designed to provoke questions, so start well before the assignment due date.

○ It is you responsibility to be aware of the university Plagiarism Policy1 and Cul-ture of Respect2.

○ Each assignment has a due date (see Brightspace)

○ Each assignment is submitted through ‘Brightspace’. Late assignments can be up to 4 days late, but experience a penalty of 10% per 24hr period. No assignments will be accepted after the 4 day period 3

• Acknowledgment; Dalhousie sits on traditional territory of the Mi’kmaq.

continued →

List of Topics:

The topics to be covered in a given week, will be announced at the start of each week.

(1) Introduction:

Basic computer organization: The sunOfLMC (a toy computer); motivation for a memory hierarchy; Quantifying system performance: Amdahl’s Law. (Ch 1)

(2) Data Representation I:

Unsigned binary ⇐⇒ Hexadecimal ⇐⇒ Decimal. Representing text: ASCII/Unicode. Bit-wise Operators in C, Representing multi-byte data. C-language basics. (2.1)

(3) Data Representation 2:

Representing integers, Two’s Complement, Arithmetic operations on signed and unsigned data. (2.2, 2.3)

(4) Data Representation 3:

Fractional binary, Floating Point representation: Limits, Example Formats, Round-ing. Casting in C. float ⇐⇒ int In C (2.4)

(5) x-86-64 Assembly I 

Correspondence: C-code ⇐⇒ Assembly Code ⇐⇒ Object Code. Operands and Addressing Formats. Address Computations, Arithmetic Ops. (3.1-3.3,3.5)

(6) x-86-64 Assembly II

Control flow: Conditionals and Loops in Assembly. Procedures and the Program Stack. (3.4,3.5)

(7) x-86-64 Assembly III

Arrays and Matrices, Heterogenous Data Structures and Pointer manipulation. Buffer Overflows. (3.6-3.10)

(8) Memory Hierarchy

Performance Trade-offs between types of Memory and the Memory Hierarchy. Caches and Cache Organization. Writing Cache friendly code. (5.1-5.6)