1/21
Looks like no tags are added yet.
Character Set
Collection of characters the set is possible to represent. Give each character a number to represent as an integer
Character Encoding
Ways to turn character integers into bit
e.g. Unicode UTF-8, UTF-16
How to check if binary number is even
If lowest bit is set, it’s odd. If lowest bit is 0, it’s even.
Multiply and Divide by shifting
Shift left to multiply by 2^n. Shift right to divide by 2^n, when shifting right, fill with 0’s for unsigned and sign extend for signed.
How to do Population Count (binary)
While n>0, increment count, then do bitwise-AND with (n-1)
What register holds pointer to top of stack
%rsp
How to make space in stack with stack pointer register
Subtract number of bytes from %rsp
How to initialize a static variable in Assembly
.data
n:
.quad 50
So n holds a quad word (64 bits), 50
Initialize an array in Assembly (Initialized)
.data
array:
.fill 100, 8, 0
Does the same as static int64_t array[100] = 0;
Operands are: repeat, bytes, value
Create an array (uninitalized)
.data
array:
.bss 50, 8
How to get memory address of static in Assembly
lea n, %rcx # rcx is pointer to n
mov (%rcx), %rdi # rdi is value of n
How to do scaled addressing
mov (%rdi, %rcx, 8), %rdx
rdx = (rdi + 8*rcx)
How to do RIP-relative addressing
mov arr(%rip), %rdi
lea n(%rip), %rdi
What is DRAM
Dynamic Random Access Memory
Using capacitors, and slower than SRAM
What is SRAM
Static Random Access Memory
Using flip flops
What is cache
Tiny amount of SRAM that sits between processor and memory, holding recently accessed memory
What is a cache line
What gets read from memory into cache when a memory access happens
What is latency
The time between request and response
What is bandwidth
The amount of data transferred per second
What is a page
The unit of data that the MMU uses for virtual addresses
What is swap
Space in disk for pages not in use. The MMU moves these pages into swap to make more physical memory space