Goals and Syllabus
From the course catalogue:
CSE 351: The Hardware/Software Interface (4) - Examines key computational abstraction levels below modern high-level languages; number representation, assembly language, introduction to C, memory management, the operating-system process model, high-level machine architecture including the memory hierarchy, and how high-level languages are implemented. Prerequisite: CSE 143.
This course should develop students’ sense of “what really happens” when software runs — and that this question can be answered at several levels of abstraction, including the hardware architecture level, the assembly level, the C programming level and the Java programming level. The core around which the course is built is C, assembly, and low-level data representation, but this is connected to higher levels (roughly how basic Java could be implemented), lower levels (the general structure of a processor), and the role of the operating system (but not how the operating system is implemented).
For (computer science) students wanting to specialize at higher levels of abstraction, this could in the extreme be the only course they take that considers the “C level” and below. However, most will take a subset of Systems Programming, Hardware Design and Implementation, Operating Systems, Compilers, etc.
For students interested in hardware, embedded systems, computer engineering, computer architecture, etc., this course is the introductory course after which other courses will delve both deeper (into specific topics) and lower (into hardware implementation, circuit design, etc.).
This course should develop students’ sense of “what really happens” when software runs — and that this question can be answered at several levels of abstraction, including the hardware architecture level, the assembly level, the C programming level and the Java programming level. The core around which the course is built is C, assembly, and low-level data representation, but this is connected to higher levels (roughly how basic Java could be implemented), lower levels (the general structure of a processor and the memory hierarchy), and the role of the operating system (but not how the operating system is implemented).
The course has three principal themes:
- Representation: how different data types (from simple integers to arrays of data structures) are represented in memory, how instructions are encoded, and how memory addresses (pointers) are generated and used to create complex structures.
- Translation: how high-level languages are translated into the basic instructions embodied in process hardware with a particular focus on C and Java.
- Control flow: how computers organize the order of their computations, keep track of where they are in large programs, and provide the illusion of multiple processes executing in parallel.
At the end of this course, students should:
- understand the multi-step process by which a high-level program becomes a stream of instructions executed by a processor;
- know what a pointer is and how to use it in manipulating complex data structures;
- be facile enough with assembly programming (X86) to write simple pieces of code and understand how it maps to high-level languages (and vice-versa);
- understand the basic organization and parameters of memory hierarchy and its importance for system performance;
- be able to explain the role of an operating system;
- know how Java fundamentally differs from C;
- grasp what parallelism is and why it is important at the system level; and
- be more effective programmers (more efficient at finding bugs, improved intuition about system performance).
Weeks are approximate; they are particularly useful for identifying topics that are essential for “connecting the pieces” yet which do not command a large portion of the class (e.g., Java-to-C). The order of presentation depends on instructor preference. There are arguments for “top down” (they already know Java), for “bottom up” (understand what’s going on below), or starting with C (useful for homeworks).
- Number representation: Two’s complement, signed vs. unsigned, floating point (1 week)
- Assembly (2 weeks)
- Memory vs. registers
- Instruction format
- Control structures in assembly (loops, procedure calls)
- C (2 weeks)
- Pointers, arrays, strings
- Memory management, malloc/free, stack vs. heap
- Compilation, linking, libraries (code across multiple files) (0.5 weeks)
- The process model (what the operating system provides, not how
it provides it) (1 week)
- Virtualization and isolation (including virtual memory)
- Components of a process state and notion of a context switch
- System calls for accessing shared resources and communication channels
- Asynchronous signals
- High-level machine architecture (2 weeks)
- Register file
- Instruction cycle
- Caching and the memory hierarchy
- The Java-to-C connection (1 week)
- Representing an object as pointer to struct with pointer to method-table; performing a method call
- Constructors as malloc-then-initialize
- Garbage collection via reachability from the stack
- Java array-bounds-checking via array-size fields
- Parallelism/multicore/pthreads (0.5 weeks)
Course Format: Three hour-long lectures plus a one-hour tutorial section per week. Total lecture hours 27-29 depending on the quarter in which class is taught. Two in-class exams (1 hour midterm and 2 hour final).
Evaluation: 4 written homework assignments, 5 lab assignments, a 1-hour in-class midterm exam, and a 2-hour in-class final exam.
ABET Credit Allocation: Four (4) credits of Engineering with a significant design component.
ABET Outcomes Coverage:
- (a) an ability to apply knowledge of mathematics, science, and engineering
Assignments and exams require the application of mathematical and engineering models to models of computation. (M)
- (b) an ability to design and conduct experiments, as well as to analyze and interpret data
Assignments require students to run experiments to determine system performance under varying conditions. (H)
- (c) an ability to design a system, component, or process to meet desired needs within realistic constraints
Assignments require students to construct programs that meet specific operational and performance constraints. (H)
- (f) an understanding of professional and ethical responsibility
Assignments and lectures expose students to the vulnerabilities of modern computing systems and security counter-measures. (M)
- (k) an ability to use the techniques, skills, and modern engineering tools necessary for engineering practice
Throughout the course, students use modern build environments and symbolic debuggers to develop and test medium-size programs. (H)
Prepared By: G. Borriello and L. Ceze
Last Revised: July 9, 2012
Background/Correspondence to Old Curriculum
The material on assembly, machine language, and CPU organization was previously taught in CSE 378. The material on number representation was taught in CSE 370. This course will be many students’ first exposure to C, where CSE 303 once held that distinction. Competent C programming is covered in a separate course: Systems Programming. In the old curriculum, the role of an operating system was briefly touched on in CSE 378, but was otherwise seen only in CSE 451.