Virtual Memory Flashcards

1
Q

what is the motivation behind virtual memory?

A
  • logical and physical addresses are completely separated
  • processes address a virtual address space, which is larger than physical memory
  • so programmers don’t have to be concerned with physical memory size
  • more programs can run at the same time because they’re not fighting for space
  • less I/O required to swap programs in and out of memory, increasing performance
  • the entire program doesn’t have to be in memory
  • allows shared memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is demand paging (basic concept)?

A

the entire program may not be needed when running. when using demand paging only the required pages are loaded into memory, as they are needed

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

what is a lazy swapper?

A

only swaps pages when they are needed

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

what is the purpose of the valid/invalid bit?

A

each entry in the page table has a flag bit that indicates if the page is in memory
if the process tries to access an invalid page, we trap to the OS in a page fault, which loads the page from disk and restarts

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

what the 5 steps in a page fault?

A
  1. check if address is legal
  2. find a free frame
  3. schedule disk read operation
  4. set the frame number and valid bit in the page table
  5. restart the instruction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is pure demand paging? problems?

A

we dont have any pages in memory when we start execution, the first instruction triggers a page fault. pages are only loaded via page fault. restarting instructions can be expensive

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

how do we calculate the EAT in page faults?

A
p = probability of page fault
ma = memory access time
EAT = (1 - p) x ma + p x page fault time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is the bottleneck in page faults?

A

disk reading because its mechanical, there’s competition

page faults REALLY slow things down

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

what is and wat are three strategies for handling over-allocation?

A
  • terminate the process
  • swap out a process entirely
  • page replacement!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is the page fault routine with replacement?

A
  • find location of page on disk
  • look for a free page frame
  • if free, carry on
  • if not, use a page replacement algorithm to select a victim
  • copy victim to disk and mark as invalid
  • read the page into the frame
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

downsides of page replacement? how to mitigate?

A
  • 2 page transferes are neeeded, which increases our page fault time
  • unmodified pages dont have to be written back, so we can use a dirty bit indicating wheter the page has been modified since it was faulted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly