Chapter 10: Virtual Memory Flashcards

(74 cards)

1
Q

What is a primary benefit of introducing virtual memory (also known as logical memory)?

A

It makes memory management easier.

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

Initially, how was the size of a process’s virtual memory constrained in relation to physical memory?

A

It was limited to the size of physical memory.

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

What does virtual memory allow regarding a process’s size compared to physical memory?

A

It allows the size of a process to be greater than the size of physical memory.

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

The technique that allows a process’s size to be greater than physical memory is known as _____.

A

demand paging

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

What is the first method mentioned for loading a program into physical memory at execution time?

A

Load the entire program in physical memory.

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

What is a potential inefficiency of loading an entire program into memory when it starts?

A

The entire program may not be needed in memory initially.

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

In a program with selectable options, what is the consequence of loading the entire program at once?

A

It loads the executable code for all options, regardless of whether an option is selected.

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

What is the second method for loading a program, which involves loading pages only as needed?

A

Demand paging.

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

With demand-paged virtual memory, pages are loaded only when they are _____ during program execution.

A

demanded

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

Under demand paging, what portion of a program is initially loaded into physical memory?

A

Only part of the program.

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

During execution with demand paging, where can a process’s pages be located?

A

Some pages will be in memory, and some will be in secondary storage.

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

What is needed to distinguish between pages in memory and pages on disk in a demand-paged system?

A

Some form of hardware support.

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

What can be added to a page table to implement demand paging?

A

A valid-invalid bit.

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

If a page’s valid-invalid bit is set to ‘valid’, where is the corresponding page located?

A

The corresponding page is in memory.

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

If a page’s valid-invalid bit is set to ‘invalid’, where is the corresponding page located?

A

The page is currently in secondary storage.

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

What event is triggered when a process tries to access a page that is not in memory?

A

A page fault, which results in a trap to the OS.

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

What is the first step the hardware takes when handling a memory access?

A

Extract the address from the current instruction.

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

What is the second step in the page fault procedure, after extracting the address?

A

Use the page table to check if the page is loaded; an ‘invalid’ bit generates a trap.

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

What is the third step the OS performs after a page fault trap is generated?

A

Find a free frame in physical memory.

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

What is the fourth step in handling a page fault, after a free frame is found?

A

Move the desired page into the newly allocated frame.

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

What is the fifth step in handling a page fault, after the needed page is moved into memory?

A

Modify the page table to indicate that the page is now in memory.

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

What is the final step in the procedure for handling a page fault?

A

Restart the instruction that was interrupted by the trap.

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

After a page fault is successfully handled, how does the process access the page?

A

As if it had always been in memory.

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

What aspect of a computer system can be significantly affected by demand paging?

A

The performance of the system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
In a demand-paged system with no page faults, the effective access time is equal to the _____.
memory access time
26
When a page fault occurs, what must happen before the desired instruction or data can be accessed?
The relevant page must be moved from secondary storage to physical memory.
27
In the formula for effective access time, what does the variable 'p' represent?
The probability of a page fault, where $0 \le p \le 1$.
28
For good performance, the probability of a page fault, 'p', is expected to be close to what value?
Zero.
29
What is the formula for effective access time, given page fault probability 'p' and memory access time 'ma'?
effective access time = $(1-p) \times ma + p \times$ page fault time
30
In the example calculation, what value is assumed for the average page-fault service time?
8 milliseconds (ms).
31
In the example calculation, what value is assumed for the memory-access time?
200 nanoseconds (ns).
32
How is 8 milliseconds represented in nanoseconds for the effective access time calculation?
8,000,000 nanoseconds.
33
What is the simplified formula for effective access time in nanoseconds, based on the provided example?
$(200 + 7,999,800 \times p)$ ns
34
What variable is the primary determinant of overall memory access performance in a demand-paged system?
The page fault probability (p).
35
When a page fault occurs, what does the operating system typically need to find to load the desired page?
A free frame in physical memory.
36
What is the situation called when a free frame is requested by the OS, but none exists?
Physical memory is full.
37
When a page fault occurs and there is no free frame, what must the OS use?
One of the page replacement algorithms.
38
What is the first step of a page replacement algorithm?
Find a victim frame.
39
After finding a victim frame, what is the second step in page replacement?
Move the victim frame to secondary storage.
40
What is the final step of a page replacement algorithm after freeing a frame?
Move the page that caused the page fault into the freed frame.
41
When page replacement is necessary, how many page transfers are required?
Two page transfers are required (one page-out and one page-in).
42
How does the need for page replacement affect the page-fault service time?
It effectively doubles the page-fault service time.
43
What is the ideal characteristic of a page-replacement algorithm that we should adopt?
The algorithm with the lowest page-fault probability.
44
How can one evaluate a page-replacement algorithm's performance?
By running it with a particular series of memory references and computing the number of page faults.
45
A series of memory references used to evaluate page-replacement algorithms is called a _____.
reference string
46
What are two methods for obtaining a reference string for evaluation purposes?
Generating it artificially or tracing a given system to record actual memory references.
47
When using a reference string, do we need to consider the detailed addresses or just the page numbers?
We only need to consider the page number.
48
If a reference to page 'p' is immediately followed by another reference to page 'p', will a page fault occur?
No, it will not cause a page fault.
49
Why does an immediate, repeated reference to the same page not cause a page fault?
Because the page will already be in memory after the first reference.
50
In addition to a reference string, what other information is needed to determine the number of page faults?
The total number of frames in physical memory.
51
What is the general relationship between the number of frames and the number of page faults?
As the total number of frames increases, the number of page faults decreases.
52
As the number of available frames increases, the number of page faults drops to some _____.
minimal level
53
What is considered the simplest page-replacement algorithm?
The first-in, first-out (FIFO) algorithm.
54
The FIFO replacement algorithm associates each page with the _____ when that page was brought into memory.
time
55
According to the FIFO page-replacement algorithm, which page is chosen for replacement?
The oldest page is chosen.
56
In the FIFO example, the next reference (2) replaces page 7 for what reason?
Because page 7 was brought in first.
57
The Optimal (OPT) page replacement algorithm replaces the page that will not be _____ for the longest period of time.
used
58
What does the use of the Optimal (OPT) page-replacement algorithm guarantee?
The lowest possible page-fault probability for a fixed number of frames.
59
In the provided example, the Optimal (OPT) algorithm resulted in how many page faults?
Nine page faults.
60
In the provided example, the FIFO algorithm resulted in how many page faults?
Fifteen page faults.
61
Why is the optimal page-replacement algorithm difficult to implement?
Because it requires knowledge about future memory accesses.
62
What is the primary use of the optimal algorithm in practice?
It is used mainly for comparison purposes to evaluate other algorithms.
63
What is the key difference in the time metric used by the FIFO and OPT algorithms?
FIFO uses the time a page was brought into memory, whereas OPT uses the time a page will be used in the future.
64
What does the acronym LRU stand for in the context of page replacement?
Least Recently Used.
65
The LRU replacement algorithm associates each page with the time of that page's _____.
last use
66
When a page must be replaced, which page does the LRU algorithm choose?
It chooses the page that has not been used for the longest period of time.
67
In the provided example, the LRU algorithm resulted in how many page faults?
Twelve page faults.
68
What key question about resource management arises in a system with multiple programs?
How many frames should be allocated to each program initially?
69
Describe the 'Equal Allocation' strategy for 'm' frames and 'n' processes.
Give everyone an equal share, m/n frames.
70
In an equal allocation scheme with 93 frames and 5 processes, how are the 3 leftover frames utilized?
They can be used as a free-frame buffer pool.
71
The Proportional Allocation strategy allocates available memory to each process according to its _____.
size
72
In the formula for Proportional Allocation, what does $s_i$ represent?
The size of the virtual memory for process $p_i$.
73
In the formula for Proportional Allocation, what does $S$ represent?
The sum of the sizes of all processes, $S=\sum s_i$.
74
What is the formula to determine the number of frames ($a_i$) for process $p_i$ using Proportional Allocation?
$a_i \approx (s_i / S) \times m$, where m is the total number of available frames.