Chapter 9: Main Memory Flashcards

(81 cards)

1
Q

What is the only general-purpose storage device that the CPU can access directly?

A

Main memory is the only general-purpose storage device that the CPU can access directly.

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

Where are programs usually stored before being loaded into memory?

A

Programs are usually stored on hard drives.

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

Why must programs be loaded into memory to be executed?

A

The CPU cannot access hard drives directly, so programs need to be loaded into memory to be executed.

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

What memory must be protected from access by user processes for correct execution?

A

The memory allocated to the operating system should not be accessed by user processes.

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

What principle must be upheld regarding the memory spaces of different user processes?

A

The memory allocated to one user process should not be accessed by another user process.

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

What is one possible solution to prevent processes from accessing each other’s memory?

A

One possible solution is to ensure that each process has a separate memory space.

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

What two hardware registers can be used to separate the memory space of processes?

A

We can provide this protection using two registers, usually a base register and a limit register.

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

What value does the ‘base register’ hold in memory management?

A

The base register holds the smallest legal physical memory address for a process.

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

What does the ‘limit register’ specify in memory management?

A

The limit register specifies the size of the legal memory range for a process.

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

In the example where the base register is 300040 and the limit register is 120900, what is the range of legally accessible addresses?

A

The process can legally access all addresses from 300040 through 420939 (inclusive).

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

What entity is exclusively permitted to modify the contents of the base and limit registers?

A

Only the OS can modify the content of these two registers in kernel mode.

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

How is memory space protection accomplished using base and limit registers?

A

The CPU hardware compares every address generated in user mode with the values in these registers.

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

What happens when a process in user mode attempts to access operating-system memory or another user’s memory?

A

The attempt results in a trap to the operating system, which treats it as an error.

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

What is a ‘logical address’ also known as?

A

A logical address is also known as a virtual address.

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

What is the term for the memory space corresponding to logical addresses?

A

The corresponding memory space is called logical memory space (or virtual memory space).

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

What kind of addresses does a user program exclusively use?

A

A user program only uses logical addresses.

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

What is the term for the real address for each storage unit in main memory?

A

A physical address is the real address for each storage unit in main memory.

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

Before data in main memory can be accessed, what must happen to logical addresses?

A

The logical addresses must be mapped to physical addresses.

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

What type of register, equivalent to a base register, is used to map logical to physical addresses?

A

A relocation register is used to accomplish the mapping from logical to physical addresses.

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

How is a logical address mapped to a physical address using a relocation register?

A

The value in the relocation register is added to every logical address used by a user process.

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

If the relocation register has a value of 14000, to what physical address is the logical address 346 mapped?

A

The logical address 346 is mapped to the physical address 14346.

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

What two entities must the main memory accommodate simultaneously?

A

The main memory must accommodate both the operating system and various user processes.

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

In contiguous memory allocation, memory is usually divided into how many partitions?

A

The memory is usually divided into two partitions: one for the operating system and one for user processes.

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

Where do many operating systems, like Linux and Windows, place the OS in memory?

A

Many operating systems place the operating system in the high memory address section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
In contiguous memory allocation, where is each process contained?
Each process is contained in a single section of memory, typically next to the section containing the next process.
26
In the variable-section scheme of contiguous memory allocation, how many processes can each section contain?
Each section may contain exactly one process.
27
What data structure does the OS maintain in a variable-section contiguous allocation scheme?
The operating system keeps a table indicating which parts of memory are available and which are occupied.
28
In contiguous allocation, a large block of available memory is considered a ____.
hole
29
What is the result of processes arriving and leaving in contiguous memory allocation?
Eventually, memory contains a set of holes of various sizes.
30
In the contiguous allocation example, after process 8 leaves, what is created in memory?
After process 8 leaves, there is one contiguous hole.
31
In the contiguous allocation example, after process 5 departs, what is the state of the free memory?
After process 5 departs, there are two noncontiguous holes.
32
What problem is concerned with satisfying a memory request of size n from a list of free holes?
The Dynamic Storage Allocation problem.
33
Define the 'First fit' dynamic storage allocation method.
First fit allocates the first hole that is big enough.
34
Define the 'Best fit' dynamic storage allocation method.
Best fit allocates the smallest hole that is big enough.
35
Define the 'Worst fit' dynamic storage allocation method.
Worst fit allocates the largest hole.
36
According to simulations, how do first fit and best fit compare to worst fit in memory utilization?
Both first fit and best fit are better than worst fit in terms of memory utilization.
37
Which is generally faster: first fit or best fit?
First fit is generally faster.
38
For exponential and hyperexponential distributions of memory requests, which strategy outperforms the other?
First-fit outperforms best-fit.
39
For normal and uniform distributions of memory requests, which strategy outperforms the other?
Best-fit outperforms first-fit.
40
Both first-fit and best-fit strategies for memory allocation suffer from what problem?
They both suffer from external fragmentation.
41
What is 'external fragmentation'?
It exists when there is enough total memory space to satisfy a request, but the available spaces are not contiguous.
42
According to statistical analysis of first fit, what fraction of memory may be unusable due to fragmentation?
1/3 of memory may be unusable due to fragmentation.
43
When does 'internal fragmentation' occur?
It occurs when allocated memory is slightly larger than the requested memory, leaving unused space internal to a section.
44
In the example of a 18,464 byte hole and a 18,462 byte request, what is the size of the resulting hole?
The resulting hole would be 2 bytes.
45
What is the general approach to solving the problem of tiny, unusable holes from contiguous allocation?
Break physical memory into fixed-sized blocks and allocate one or more blocks to each process.
46
The memory management scheme called _____ permits a process's physical address space to be noncontiguous.
paging
47
What problem does the paging memory-management scheme avoid?
Paging avoids the external fragmentation problem.
48
The basic method for paging involves breaking physical memory into fixed-sized blocks called _____.
frames
49
The basic method for paging involves breaking logical memory into blocks of the same size called _____.
pages
50
When a process is to be executed using paging, where are its pages loaded?
Its pages are loaded into available memory frames.
51
In paging, every logical address is divided into what two parts?
A page number (p) and a page offset (d).
52
In address translation via paging, what is the page number used for?
The page number is used as an index into the page table.
53
After using the page number to index the page table, what corresponding information is extracted?
The corresponding frame number (f) is extracted from the page table.
54
To form a physical address in paging, the page number (p) in the logical address is replaced by what?
The page number (p) is replaced with the frame number (f).
55
What determines the page size in a paging scheme?
The page size is defined by the hardware and is usually determined by the processor architecture.
56
The size of a page is typically a power of what number?
The size of a page is a power of 2.
57
If logical address space size is $2^m$ bytes and page size is $2^n$ bytes, how many bits represent the page number?
The high-order $(m-n)$ bits of a logical address correspond to the page number.
58
If logical address space size is $2^m$ bytes and page size is $2^n$ bytes, how many bits represent the page offset?
The n low-order bits of the logical address designate the page offset.
59
In the example given, the logical address $7_{10}$ is what in binary?
The logical address $7_{10}$ is $0111_2$.
60
For the logical address $0111_2$ with $m=4$ and $n=2$, what is the page number and page offset in binary?
The Page Number is $01_2$ and the Page Offset is $11_2$.
61
Following the example, if page number $01_2$ maps to frame number $110_2$, what is the final physical address for logical address $7_{10}$?
The final physical address is $11011_2 = 27_{10}$.
62
Using the example page table, what physical address corresponds to the logical address $4_{10}$?
The logical address $4_{10}$ ($0100_2$) corresponds to the physical address $24_{10}$ ($11000_2$).
63
Using the example page table, what physical address corresponds to the logical address $13_{10}$?
The logical address $13_{10}$ ($1101_2$) corresponds to the physical address $9_{10}$ ($01001_2$).
64
What kind of fragmentation is eliminated when using a paging scheme?
When we use a paging scheme, we have no external fragmentation.
65
Although paging eliminates external fragmentation, what type of fragmentation can still occur?
We may have some internal fragmentation.
66
Why does internal fragmentation occur with paging?
If the memory requirement of a process does not coincide with page boundaries, the last allocated frame is not completely full.
67
In the worst case of internal fragmentation, a process needing n pages plus 1 byte results in a waste of almost how much memory?
It results in a waste of almost an entire frame.
68
If process size is independent of page size, what is the expected average internal fragmentation waste per process?
We expect internal fragmentation to lead to a half-page per process waste on average.
69
What characteristic of page size is desirable to minimize internal fragmentation?
Small page size is desirable.
70
What is the trade-off of using smaller page sizes?
Overhead is involved in each page-table entry, and this overhead is reduced as the page size increases.
71
What are typical page sizes in modern computer systems?
Today, a page is typically either 4 KB or 8 KB in size.
72
When a new process requiring n pages arrives, what is the minimum number of frames that must be available?
If the process requires n pages, at least n frames must be available in memory.
73
What system-wide data structure does the OS use to keep track of physical memory allocation?
The allocation information is generally kept in a single, system-wide data structure called a frame table.
74
What information does an entry in the frame table contain?
It has one entry for each physical frame, indicating if it's free or allocated, and if allocated, to which page of which process.
75
What problem arises with page tables in modern systems that support a large logical address space (e.g., $2^{32}$ to $2^{64}$)?
The page table itself becomes very large.
76
For a system with a 32-bit logical address space and a 4 KB page size, how many entries might a page table have?
A page table may consist of over 1 million entries ($2^{20}$).
77
Assuming 4 bytes per entry, how much physical memory might a single page table require in a 32-bit system?
Each process may need up to 4 MB of physical address space for the page table alone.
78
Why is it undesirable to allocate a large page table contiguously in main memory?
Page tables may come and go, resulting in fragmentation.
79
What is a simple solution to the problem of large, contiguous page tables?
A simple solution is to divide the page table into smaller pieces.
80
What is one way to divide a page table into smaller pieces?
One way is to use a two-level paging algorithm.
81
In a two-level paging algorithm, what is done to the page table itself?
The page table itself is also paged.