lecture 13 Flashcards

Virtual memory, address translation, and putting it all together!

1
Q

MMU

A

memory management unit

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

role of MMU

A

responsible for translating a virtual address to a physcial address in DRAM

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

relationship between MMU and CPU

A

MMU is a program inside CPU

cpu –> holds virtual address located in DRAM in a register
mmu –> translates this address held in the register to physical address in DRAM

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

relationship between MMU and DRAM

A

mmu –> mmu page table, array of PTEs that map virtual pages to page frames
page frames –> cached into physical memory (DRAM)
- loaded into DRAM

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

How does virtual memory (VM) overcome physical memory limitations?

A

vm –> makes every program think its the only one running in main memory at that time (not true),
- mmu and os beat memory
fragmentation by making sure
everything gets mapped to
correct section in DRAM
- vm lets multiple programs run at
same time by running them in
virtual memory and mapping
them to certain addresses in
physical memory

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

role of VM during the assemble and linking steps

A

os –> defines “common” virtual address space that are used by linker and loader

“common” virtual address space –> can be applied for all programs (same heap memory segment will have same virtual address locations)

MMU translates these addresses to physical address in DRAM

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

total number of virtual addresses =

A

2^n
n = virtual address bits

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

total number of PTEs =

A

2^(n-p)
n = virtual address bits
p = vpo bits

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

size of one page (in bytes) =

A

2^p
p = vpo bits

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

total number of physical addresses =

A

2^m
m = physical address bits

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

total number of physical memory frames =

A

2^m / 2^p = 2^(m-p)
m = physical address bits
p = pfo bits
(m-p) = pfn bits

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

size of one frame (in bytes) =

A

2^p
p = pfo bits

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

are frame size and page size the same size?

A

yes, # of VPO bits = # of PFO bits

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

virtual page

A

virtual memory = array that holds fixed-sized blocks –> virtual pages

virtual pages –> binary files that reside on the ssd

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

size of vp =

A

2^p
p = # of page offset bits

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

total # of vps =

A

2^(n-p) - 1

16
Q

3 states vp can be in:

A
  1. unallocated
  2. cached
  3. uncached
17
Q

unallocated vp

A

page has not yet been allocated in DRAM or file has not been put on SSD by vm system

18
Q

cached vp

A

page is allocated on SSD and currently in DRAM

19
Q

uncached vp

A

page is allocated on SSD but no currently in DRAM

20
Q

How are PTEs used to determine if a VP is cached in a PF in DRAM

A

valid/present bit = 1, PTE is cached in PF in DRAM

21
Q

How are PTEs used to determine if a VP is uncached in a PF in DRAM

A

valid/present bit = 0, PTE is uncached in PF in DRAM

22
Q

what does the MMU do when there is a page fault?

A

page fault –> virtual address references VP that is not cached into DRAM (not loaded into any page frame in DRAM)

causes exception, fault handler selects VP to evict from page frame in DRAM

MMU –> swaps the original VP in DRAM with needed VP (VP in DRAM gets copied into file on SSD, VP in SSD gets copied into page frame in DRAM)

23
Q

relationship between VPN, PFN, and present bit

A

VPN (index in page table used to translate virtual to physical) –> CPU uses to address virtual pages

PFN (represents physical location of page in DRAM) –> OS uses to map those virtual pages to physical memory in DRAM

Present bit (tells if virtual page is cached/in DRAM or uncached/not in DRAM) –> indicates whether the page is in physical memory or not

** all are PTEs

24
Q

cpu register holds

A

physical address in DRAM

25
Q

virtual memory structure

A

array data structure with fixed sized blocks

26
Q

fixed sized blocks in virtual memory

A

virtual pages

27
Q

virtual pages

A

binary file that resides on secondary storage device (SSD)

28
Q

total # of vps =

A

2^(n-p) - 1

29
Q

page means

A

virtual memory

30
Q

frame means

A

physical memory