Midterm 1 Flashcards

1
Q

1 GB =

A

2^30

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

1 MB =

A

2^20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

1 KB =

A

2^10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

giga-

A

10^9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Static rewriting

A

rewrites two processes’ addresses to be distinct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Static rewriting issues

A
  1. relocation at runtime is hard (have to constantly rewrite process memory and pointers are hard to keep track of and manage)
  2. security (no isolation, pointers can access any random location)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Dynamic relocation

A
  1. base:
    virtual address + base = physical address

can just change the base to automatically shift processes to new locations

  1. bound:
    mem access checked by bound (if out of bound –> interrupt)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

can processes access base and bound registers?

A

NO!!!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

base and bounds implementation

A

new CPU unit called memory management unit (MMU)

MMU has two registers: base and bounds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

dynamic relocation issues

A

programs aren’t contiguous (chunks of free space between allocated memory)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Segmentation

A

using multiple base and bounds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is a segment?

A

a base and bound pair that can be efficiently resized

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

segmentation implementation

A

uses MMU with a segment table containing variable # of segments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

segmentation issues

A

requires contiguous regions but also results in external fragmentation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

external fragmentation

A

combined space is large enough but memory is fragmented –> not individual free mem segment is useful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

internal fragmentation

A

the memory reserved for a process can’t be used by OS until the process terminates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

external fragmentation solution! (the bad one)

A

defragmentation: move previously allocated regions to get contiguous free space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

defragmentation issues

A

expensive! running process might be stopped and allocation takes too long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

external fragmentation solution! (the good one)

A

paging!

20
Q

Paging idea

A

fine-grained and regular (constant) division of memory (called pages)

21
Q

frames

A

fixed sized blocks of physical memory

22
Q

pages

A

fixed sized blocks of a process’ address space

23
Q

frame size = ?

A

page size

24
Q

pros of paging

A
  1. don’t need a large contiguous region
    (process still sees the address space as contiguous)
  2. any page can be mapped to any frame
25
Q

Page table

A

structure that maps a page to a frame using the virtual address

  • uses the MMU
  • only OS can change the page table
26
Q

each process has its own page table

A

true

27
Q

one-to-one paging

A

page table is just a linear array where each page has its own page table entry

the page table entry contains the final frame number

28
Q

address space (AS) limit/size

A

how much memory MAX the OS will allocate to one process

29
Q

equation relating AS limit, page size, # pages

A

AS limit/page size = # pages

30
Q

how to find a where page tables are stored in DRAM?

A

page table base register (ptbr)
- accessed only in S-mode
- shows physical address

if linear PT:
- can find any PTE from ptbr

if multi-page:
- ptbr points to highest level PT

31
Q

one-to-one (linear) paging issues?

A

a PT can require A LOT of contiguous space

= # PTEs * size of a PTE

32
Q

multi-level page tables

A

solve the space issue of linear PTs:

  • multiple small PT instead of one big PT
  • only allocate each table when needed
  • remaining space in the address
33
Q

size of a PTE =

A

architectural size (64-bit systems have 64-bit PTEs)

34
Q

layout of a PTE (linear)

A

upper bits: physical frame #
lower bits: page permissions

35
Q

where are page tables stored: CPU cache or DRAM?

A

DRAM: cache is faster but much more expensive (not much memory space)

36
Q

multi-level paging issues?

A

memory access is expensive:
if you have N-levels of page tables, you need N + 1 DRAM accesses = N page tables + final frame access

37
Q

multi-paging issues solutions!

A
  1. TLB - translation lookaside buffer
  2. cache
38
Q

TLB

A

stores final translation (not the data itself)

  • OS needs to clear old TLB entries if any changes to PT are made
39
Q

TLB issues

A

sometimes we need to:
1. check TLB to see if translation is cached

  1. if not, store translation after walking the page table

** CPUs have optimization algorithms so TLB hits rates are very high and these issues are not significant

40
Q

cache for paging why?

A

DRAM is slow, regardless of TLB hit or not

41
Q

cache stores ___ while TLB stores ___

A

data, translation

42
Q

memory access steps

A
  1. check cache
  2. cache miss –> check TLB
    2a. TLB hit –> physical frame –> done

2b. TLB miss –> walk the PTs to find physical address
3. insert translation into TLB
4. insert data into cache

43
Q

library sharing

A
44
Q

lazy on-demand memory allocation

A
45
Q
A