Skip to content

CS 315-02 Lecture/Lab — Meeting Summary (Fall 2025)

  • Date: September 16, 2025
  • Time: 02:54 PM Pacific
  • Zoom ID: 868 6589 0521

Quick Recap

  • Greg outlined updates to the class schedule and expectations for practice exam problems.
  • He reviewed core computer science concepts: memory layout, byte addressing, endianness, and binary representation of integers.
  • The session concluded with instruction on string manipulation in assembly and the value of using debugging tools in software development.

Next Steps

  • Greg:
  • Send a schedule with interactive reading slots for Tuesday.
  • Cover “Hello, World” in assembly in the next lecture.
  • Revisit memory layout, two’s complement, and strings in assembly in upcoming lectures.
  • Provide additional practice exam problems weekly until the midterm.
  • Allocate lab time for students to work on practice problems.

  • Students:

  • Submit practice exam problems by Friday to the Lab4 repo as problems.pdf.
  • Show complete work in practice exam solutions, not just final answers.
  • Convert handwritten solutions to PDF prior to submission.
  • Prepare for interactive grading by understanding their code thoroughly.
  • Attend interactive grading sessions to demonstrate and explain their code.

  • Greg and TAs:

  • Conduct interactive grading sessions throughout the semester.

Summary

Class Schedule and Exam Updates

  • Interactive reading sessions will be conducted via Zoom due to reduced TA hours and budget constraints.
  • Lectures will be rescheduled as needed to accommodate lab work, with multiple time slots available (including regular class periods).
  • For practice exam problems:
  • Submissions must be named problems.pdf in the Lab4 repo.
  • Students must include worked-out solutions, not only final answers.

Memory Layout in Programming Languages

  • Understanding memory layout is essential, especially in C/C++, where developers must know where data and code reside.
  • High-level languages (e.g., Python, Java) abstract memory management; lower-level languages (e.g., C) require explicit knowledge of memory and addresses.
  • Key concepts introduced:
  • Processor components (e.g., program counter) and memory structure.
  • Execution model: instructions operate on data in registers and memory.
  • Memory as an array of bytes—a fundamental model to be revisited throughout the semester.

Byte Addressing in Computer Memory

  • Memory addresses are measured in bytes (8 bits), with consecutive addresses pointing to consecutive bytes.
  • Example discussed: a 32-bit integer in hexadecimal and how it may be arranged in memory.
  • Visualized how a 4-byte integer is stored, including one ordering from least significant byte to most significant byte.

Endianness in Computing

  • Defined endianness and the difference between big-endian and little-endian byte orders.
  • Little-endian (common on Intel x86 and RISC-V): least significant byte at the lowest address.
  • Big-endian (used historically on early Macintosh and Sun systems): most significant byte at the lowest address; often more human-readable in memory dumps.
  • Clarified implications for reading multi-byte numbers in memory.

Byte Ordering Demonstration with C

  • Demonstrated how to detect byte order by inspecting an integer’s bytes via pointers in C.
  • Confirmed little-endian ordering on the demonstration system (least significant byte at the lowest address).
  • Highlighted networking implications:
  • Network byte order is big-endian.
  • Data sent over TCP/IP must be converted between host byte order and network byte order.

Binary Representation and Two’s Complement

  • Reviewed signed integer representations:
  • Problems with sign-magnitude (two representations of zero, broken arithmetic).
  • Two’s complement as the standard solution enabling correct addition/subtraction across positive and negative values.
  • Showed conversions between positive and negative values using bit inversion and adding/subtracting one.

Sign Extension

  • Explained sign extension when widening signed integers (e.g., 4-bit to 8-bit): replicate the sign bit into the new high bits.
  • Demonstrated conversions and reasoning using bitwise operations and arithmetic in C.
  • Noted:
  • The most significant bit indicates the sign (negativity).
  • Lower bits determine magnitude.

Strings and Load Instructions in Assembly

  • Strings are arrays of characters (bytes); in C, they are null-terminated.
  • Discussed memory layout of C strings.
  • Introduced load instructions such as LB (load byte) and their interaction with 64-bit registers.
  • Showed how to operate on 8-bit values within 64-bit registers using arithmetic instructions.

String Manipulation in Assembly Language

  • Demonstrated string length (strlen) using pointer arithmetic and loops; contrasted array indexing vs. pointer-based iteration.
  • Implemented string copy (strcpy) in C and assembly:
  • Emphasized the need to write the terminating null byte to the destination.
  • Encouraged use of debugging tools (e.g., GDB) to inspect memory and program behavior, highlighting debugging as a key development skill.