Course Computer Systems for AI-programmers

"Computersystemen voor AI-programmeurs"

Week 6, February 2011

Description

In this class, we peer beneath the layer of abstraction provided by a high-level language and get a view of the machine-level. By letting the compiler generate assembly code of very simple C-functions, we get insight of the instruction set a compiler is working with.

Assembly language is very different from C code. In assembly language, there is minimal distinction between data types. The program is expressed as a sequence of very simple operations. Still, part of the program state, such as registers and run-time stack, are directly visible to the programmer (and the user, after a programming error).

Only the mapping of C onto the Intel 32-bits instruction set is shown, but the same principles hold for other combinations of languages and machines.

In this class the following concepts are introduced:

  • control constructs as conditionals and loops, dissambler
  • arrays, nested arrays, dynamic allocated arrays
  • structures, unions and their allignments
  • understanding pointers

Literature

The class is based on chapter 3 of the book Computer Systems: A programmer's perspective by R.E. Bryant and D.R. O'Hallaron.

Recommanded reading (afterwards, 47 pages, 2 hours):

3.4Accessing Information
3.5Arithmetic and Logical Information
3.6Control
3.8Array Allocation and Access
3.9Heterogeneous Data Structures
3.10Putting it Together: Understanding Pointers
3.13x86-64: Extending IA32 to 64 Bits


Schedule

The class is scheduled in one hours:

  1. Lecture (Recording): 'Machine Basics'
  2. Lecture (Recording): 'Computer system - Control in C'
    Practice Problem 3.21: 'Write a goto-version of loop_while().'
    Practice Problem 3.28: 'Identify the case-labels of switch2().
  3. Lecture (Recording): 'Computer system - Data Structures in C'
    Practice Problem 3.41: 'Determine the allignment under Linux/IAS32 for these 5 structures'
  4. Lecture (Recording): Procedures
  5. Read section 3.10: Putting it Together: Understanding Pointers
    Study fun.c: 'Code illustrating use of pointers in C.'
  6. Two week assignment: 'Defuse as many possible phases of a binary-bomb' , description.

Links

Last updated September 10, 2013

o This web-page and the list of participants to this course is maintained by Arnoud Visser (arnoud@science.uva.nl)
Faculty of Science
University of Amsterdam

visitors in arnoud@science.uva.nl