VM Flashcards

1
Q

issues with sharing pmem

A

protection, transparency, resource exhaustion

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

protection

A

prevent processes from observing other process’ memory
e.g. bug in one process should not affect another

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

transparency

A

a process should not require particular physical addresses
but we often need contiguous addresses

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

resource exhaustion

A

programmers typically assume the system has enough memory
the sum of all processes is usually greater than pmem

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

MMU jobs

A
  1. translate virtual to physical
  2. enforce memory protection
  3. allow programs to see more memory than exists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

load-time linking idea

A

determine where a process will reside in memory and adjust all references within the program

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

problems with load-time linking

A

how to protect?
how to relocate?
what if no contiguous free region?

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

base/bound idea

A

easy relocation by changing base
must save/restore base/bound on context switches

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

advantages of base/bound

A

inexpensive in hardware
inexpensive in cycles

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

disadvantages of base/bound

A

growing a process is expensive/impossible
no way to share code/data

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

segmentation idea

A

let processes have many base/bounds

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

segmentation advantages

A

allows multiple segments per process
allows sharing of code/data
don’t need entire process in memory

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

disadvantages of segmentation

A

requires address translation hardware, limits performance
segments not completely transparent e.g. default segment faster
n byte segment needs b contiguous bytes of pmem
fragmentation

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

hardware lookup algorithm

A

KMPVRN

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

paging tradeoffs

A

eliminates external fragmentation
simplifies allocation, free, and backing storage
avg internal frag of 0.5 pages per “segment”

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

why is the MIPS UTLB handler separate from general exception handler?

A

UTLBs very frequent, hand optimized path
64 entry TLB only 256kiB
modern working sets don’t fit

17
Q

why do we typically not want paging and segmentation?

A

too much overhead

18
Q

when is paging + segmentation useful?

A

detect stack overflow or thread-local storage

19
Q

what does thread-local storage do?

A

changes a global var to local for each thread

20
Q

how is thread-local storage achieved?

A

global var relative to %fs register, each thread has its own base address stored in %fs

21
Q

what happens to the TLB on a context switch?

A

old x86 flushes TLB
MIPS tags each entry with PID, no need to flush

22
Q

where does the OS live?

A

kernel addresses are in the same address space as the user process

23
Q

what’s demand paging?

A

only loading pages if they are needed

24
Q

what’s copy on write?

A

share a reference, (fork, mmap) if a write happens, then make a copy

25
Q

what do we need zeroed pages for?

A

stack, heap, anonymously mmapped memory for devices

26
Q

what’s Belady’s anomaly?

A

adding more physical memory doesn’t always mean fewer faults

27
Q

thrashing

A

application constantly swapping pages in and out, preventing reasonable progress

28
Q

reasons for thrashing?

A

memory access does not exhibit temporal locality
working set does not fit in physical memory
each process fits individually, but there are too many for the system

29
Q

what’s the breakpoint?

A

top of the heap
addresses between breakpoint and top of the stack are invalid

30
Q

char * brk(const char * addr);

A

set and return new value of breakpoint

31
Q

char * sbrk(int incr)

A

increment value of the breakpoint and return the old value

32
Q

void * mmap(void * addr, size_t len, int prot, int flags, int fd, off_t offset)

A

treat a file as if it were memory
map fd to addr except that changes are backed up to the file
can be shared with other processes
prot specifies protection of region
flags sets who can see modifications

33
Q

vm tricks at user level

A

use mprotect and sigaction to set protections and actions
e.g. OO database
bring in objects on demand, keep track of dirty objects, manage memory as a cache for a huge object DB

34
Q

paging in day to day use

A

demand paging
copy on write
growing the stack
BSS page allocations
sharing text/library
sharing memory