CS 2150 Roadmap

Data Representation

Program Representation

 
 
string
 
 
 
int x[3]
 
 
 
char x
 
 
 
0x9cd0f0ad
 
 
 
01101011
vertical red double arrow  
Objects
 
Arrays
 
Primitive types
 
Addresses
 
bits
           
 
Java code
 
 
C++ code
 
 
C code
 
 
x86 code
 
 
IBCM
 
 
hexadecimal
vertical green double arrow  
High-level language
 
Low-level language
 
Assembly language
 
Machine code

Memory Allocators

Lifetime
ScopedUnlimited
 
Size
Knownlocal variable declarationsglobal, static variable declarations
Unknownalloca()new & malloc()

 

alloca(): like malloc(), but on the stack, not the heap (rarely used)

x86 callee epilogue

; subroutine epilogue

; recover saved registers,
; reverse of push order
pop esi
pop edi

; deallocate local var(s)
mov esp, ebp

; restore base pointer
pop ebp

; return
ret		
activation record

 

How would this change with alloca()?

Memory Hierarchy, part 1

memory hierarchy
  • CPU registers
    • 1 access per CPU cycle
    • 3*109 accesses per sec
    • 1 Kb total storage
  • Cache
    • SDRAM: 10 ns
    • 108 accesses per sec
    • Multiple levels possible
    • Higher levels are bigger and slower
    • 1 Mb total storage

Memory Hierarchy, part 2

memory hierarchy
  • Main memory
    • DRAM: 60 ns
    • 2*107 accesses per sec
    • Limited by bus speeds
    • 1 Gb total storage
  • Disk
    • HDD speeds: 5 ms
    • 200 accesses per sec
    • 1 Tb total storage