Week 8: Virtual Memory Flashcards

1
Q

What is the basic principle behind virtual memory?

A

At any given time, only the code and data needed for the current instruction must be in physical memory.

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

How does the operating system handle references to virtual memory and not to physical memory?

A

By recognizing them and fetching the required data into memory.

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

What is logical address space?

A

The address space that a program assumes is available, mapped to physical memory during execution.

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

How large is the logical address space for a 32-bit processor?

A

4GB (2³² bytes).

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

What are pages and page frames?

A

Pages are blocks of memory in logical address space, and page frames are their counterparts in physical memory.

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

Why are pages and page frames the same size?

A

To simplify mapping between logical and physical memory.

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

What role does the memory management unit (MMU) play in address translation?

A

It intercepts logical addresses and maps them to physical addresses using a page table.

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

What is a page table?

A

A data structure that stores the mapping between page numbers and page frame numbers.

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

Why are multilevel page tables used?

A

To reduce the size of page tables for systems with large address spaces.

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

How does multilevel indexing work?

A

It splits the page table into layers, reducing the memory needed for storing the entire table.

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

What is a page fault?

A

An interrupt generated when a process accesses a page not currently in physical memory.

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

What is demand paging?

A

Loading a page into memory only when it is needed.

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

What is the goal of page replacement algorithms?

A

To decide which page to remove from memory to make space for a new page.

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

How does the optimal page replacement algorithm work?

A

It replaces the page that will not be used for the longest time in the future.

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

Why is the optimal algorithm impractical?

A

A: It requires knowledge of future memory references.

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

How does the Not-Recently-Used (NRU) replacement algorithm work?

A

It records if a page is referenced or modified and saves it in the page table. The reference flag is reset at regular intervals (e.g., system clock interrupt). When a page fault occurs the pages are examined:
- Class 0: not referenced, not modified,
- Class 1: not referenced, modified,
- Class 2: referenced, not modified,
- Class 3: referenced, modified
A random page of the lowest available class is chosen

17
Q

How does the FIFO algorithm work?

A

It removes the oldest page in memory, based on insertion order.

18
Q

What is the disadvantage of FIFO?

A

It may remove frequently used pages.

19
Q

How does the second chance algorithm improve FIFO?

A

It checks if the oldest page has been recently referenced and gives it another chance if it has.

20
Q

What is the clock algorithm?

A

A circular implementation of second chance that uses a pointer to track pages.

21
Q

How does LRU approximate the optimal algorithm?

A

By replacing the page that has not been used for the longest time.

22
Q

What are the challenges of implementing LRU?

A

It requires keeping track of the last usage time for every page.

23
Q

What factors influence the design of virtual memory systems?

A

Page size, prepaging strategies, and maintaining free pages.

24
Q

What is a paging demon?

A

A process that periodically frees old pages to maintain a pool of free pages.