comparison: mixed sign/unsigned -> cast all to unsigned Endian = little


infinity: exp = all 1s and frac = all 0s Nan: exp = all 1s and frac != all 0s


condition codes: set by cmpq, testq, jne(not equal / not zero) - CF: Carry Flag (for unsigned) - ZF: Zero Flag - SF: Sign Flag (for signed) - OF: Overflow Flag (for signed)


immediate (constant integer): $0x400, $-533

pushq [src] (7th argument is at %rsp): sub 0x08, %rsp, mov [src], (%rsp) call [label]: push %rip, jmp [label] ret: pop %rip


Stack: run-time. 8MB limit Heap: malloc()

SRAM: refresh in spacial locality (so memory access with spacial locality is good)

Cold (compulsory) miss: empty Capacity miss: when working set is larger than the cache (no enough cache space to store all needed data for a program, cache is full and your data is not here) Conflict miss: when multiple objects all map to the same level k block (hash collision: block i at Lk+1 must be placed in block i mod 4 at Lk, referencing blocks 0, 8, 0, 8,... will miss every time)

Write-back + Write-allocate + Copy-on-Write (Anonymous file)

Page Table

Address Example: 9+9+9+9+12=48 virtual address, 40+12=52 physical address, 4KB page size (2^12 byte page table, 8 byte payload per entry, 2^9 entries)


Symbol Table: store symbol definition

.data: initialized global, static variable, string constant .text: Code, Libraries .bss: uninitialized globals (only header) .symtab: procedure, static variable name

Executable and Link-able Format (ELF)

Relocatable Object File (.o): can be combined with other relocatable file, from a .c file Executable Object File (a.out): linking (.o .a .so), link library at last cmd Shared Object File (.so): linked dynamically Static Libraries (.a archive files): created by achiever with (.o) dlopen(): link at run-time


Global Symbols: non-static function, non-static global variable External Symbols: global symbols that are referenced but not defined by current module (printf) Local Symbols: only referenced in current module (static function, static variables either in function or global)

Not in symbol table: local variable in function, arguments, (maybe string) static variable: exist in life time of program, but accessible only in scope

Strong Symbol: procedures and initialized globals Weak Symbol: uninitialized globals, or declared with extern(has to be resolved).

Linking Rules

  1. Multiple strong symbols are not allowed. (error)
  2. Given a strong symbol and multiple weak symbols, the symbol is defined by strong symbol
  3. If there are multiple weak symbols, pick an arbitrary one
  4. Linker does not do type check (including function argument type)

setX Table

setX Table

jX Table

jX Table



Not Included

TODO: union in lecture 008 TODO: look at piazza

Array Access

array access

array access

difficult array access

difficult array access

array access 1

array access 1

array access 2

array access 2

Table of Content