CMPT295 Quiz 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

22 Terms

1
New cards

Character Set

Collection of characters the set is possible to represent. Give each character a number to represent as an integer

2
New cards

Character Encoding

Ways to turn character integers into bit

e.g. Unicode UTF-8, UTF-16

3
New cards

How to check if binary number is even

If lowest bit is set, it’s odd. If lowest bit is 0, it’s even.

4
New cards

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.

5
New cards

How to do Population Count (binary)

While n>0, increment count, then do bitwise-AND with (n-1)

6
New cards

What register holds pointer to top of stack

%rsp

7
New cards

How to make space in stack with stack pointer register

Subtract number of bytes from %rsp

8
New cards

How to initialize a static variable in Assembly

.data

n:

.quad 50


So n holds a quad word (64 bits), 50

9
New cards

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

10
New cards

Create an array (uninitalized)

.data

array:

.bss 50, 8

11
New cards

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

12
New cards

How to do scaled addressing

mov (%rdi, %rcx, 8), %rdx

rdx = (rdi + 8*rcx)

13
New cards

How to do RIP-relative addressing

mov arr(%rip), %rdi

lea n(%rip), %rdi

14
New cards

What is DRAM

Dynamic Random Access Memory

Using capacitors, and slower than SRAM

15
New cards

What is SRAM

Static Random Access Memory

Using flip flops

16
New cards

What is cache

Tiny amount of SRAM that sits between processor and memory, holding recently accessed memory

17
New cards

What is a cache line

What gets read from memory into cache when a memory access happens

18
New cards

What is latency

The time between request and response

19
New cards

What is bandwidth

The amount of data transferred per second

20
New cards

What is a page

The unit of data that the MMU uses for virtual addresses

21
New cards

What is swap

Space in disk for pages not in use. The MMU moves these pages into swap to make more physical memory space

22
New cards