Systems Final

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

What is the ISA, and describe the two different types

  • the ISA is like the API for hardware, and tells compilers/programmers how to write my code

  • RISC ISA:

    • All instructions same size in bytes

    • More registers available

    • Operate on registers only

    • smartphones have this

  • CISC ISA:

    • variable length instruction size in bytes

    • Fewer registers available
      Operate on memory or registers

    • Desktop/Laptops have this

2
New cards

SRAM & DRAM

  • SRAM (bigger, indefinite)

    • Static Ram

    • each bit implemented with a 6 transistor circuit

    • retains current value indefinitely

    • resistant to electrical noise

  • DRAM

    • Dynamic Ram

    • Each bit stored in dense 1 transistor

    • retains current value for a max of 0.1 seconds

    • suspectible to electrical noise and hardware attacks

    • bit is refreshed every 64 ms

3
New cards

Explain caching and the two types of locality

  • Your computer keeps relevant information in a small but fast memory location (this is called locality) to be accessed easily

    • Spatial (awareness) locality - if data is accessed, data at nearby memory locations is likely to be accessed soon too

    • Temporal (same) locality - if data is accessed, the same data at that memory location will likely be accessed soon too

4
New cards

Explain Amdahl’s Law and how its relevant to computers

if we want to speed up a computer system, we don’t speed up only a tiny bit; we speed up a large portion of the system for it to be significant

5
New cards

Explain the 4 different flags

Zero Flag: Set to 1 if the result is 0

Carry flag: The last carry out is a 1 (remember to check the right 8 bits)

NEXT TWO: only consider the max bits from the addition problems (8 bit + 8 bit = 9 bit, but only consider the right 8 bits)

Sign(ed) flag: the left-most bit is 1

Overflow flag: adding two numbers of the same sign (check the left-most bit) and it’s a different sign (remember to check the right 8 bits)

0 = negative, 1 = positive

  • when you add 2 numbers with W bits, you need W + 1 bits at the most

  • when you multiply 2 numbers with W bits, you need 2W bits at the most

6
New cards

Explain endianness and how you know if something is big/little endian for the following:

19 23 21

  • Lowest byte sits at the lowest address (and where it starts in memory is what we see)

  • basically left side has the biggest bytes and right side has the smaller bytes

  • if the address shows 21 that means its little endian because 21 is the smallest byte

  • if the address shows 19 its big endian because 19 is the biggest byte

7
New cards

describe what goes in different .section’s and where you should put strings

.rodata: read only data, put strings here using .string

.text: where your assembly code resides. do not put a .string under a label that causes undefined behavior

.data: initialized global variables

.bss (bs - so not good): uninitialized global variables

8
New cards

lets say a function pointer is in %rax and you want to call it. What do you do and what does the symbol you use do

do call *%rax

the * indicates that the value stored there is a pointer, it does not generate an address/pointer

9
New cards

what does the statement do and identify the 3 parameters in it

movl (%rdi, %rsi, 4), %rax

  • this moves the VALUE at the array index into %rax

  • %rdi is the pointer to the 0th index in the array

  • %rsi is the index number (an integer always)

  • 4 represents the byte size of each element in the array, here its 4 so that means we are accessing an array of integers

10
New cards

Describe pipeline flush, and the 4 stages of pipelining

when you write code, you have many branches and jumps to certain labels. if you have too many jumps, it may not be your fault, but the CPU may mess up and mispredict/guess which label you are jumping too, so don’t make your code too compliated

fetch decode execute write (intel pieplines have about 10 to 30 stages for this)

11
New cards

Describe linking/relocation and what happens

  • Linking is the idea/process that code is combined into a single file, by including appropriate libraries

  • Since files contain symbols (global variables/functions) these are also relocated to the final code file

  • Strong symbols - initialized globals:

  • Example of strong (good) symbol: func hi() { } (functions dont have to have a body they are still strong symbols)

  • Weak symbols - uninitialized globals

12
New cards

Describe the two types of relocation

  • Absolute Relocation

    • 64 bit address of symbol is calculated for the instruction, and usually updates movements between registers (movq, incq etc.

  • Relative relocation

    • linker calculates 32-bit offset following a jmp or call

13
New cards

Describe how modern computers are different than from the past

They use multiple pipelines, efficient memory access with a cache system, register renaming, and branch prediction, but hide this complexity behind the ISA

14
New cards

Describe the 3 parts of linking and what happens in each

build time - deals with gcc/compiler, static libraries are linked

load time - deals with the loaders and dynamic/shared libraries are linked (this deals with print/scanf)

execution - happens when the program is running, and it automatically adds all other libraries

15
New cards

Linker symbol rules (for programming creating global variables)

  1. multiple strong symbols not allowed (two different files) p1() and p1() in two different files, that is not allowed they are initialized globals so they are strong symbols

  2. GIven a strong & weak, strong dominates. int x = 5 and int x in two different files. References to weak resolve to the strong one

16
New cards

Describe what represents the pyramid that represents memory accessing

Register (SRAM)

Caches (SRAM)

DRAM & Main Memory

higher up means faster access

lower means takes up more space in memory