9. Virtual Memory Flashcards

1
Q

What main problems are addressed by virtual memory?

A

Capacity (we wish for the physical memory to be smaller than the address space)

Safety (we want to prevent user programs from accessing the memory used by the OS and want to make sure that user programs cannot interfere with each other)

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

Give a brief summary of the concept of virtual memory.

A

Each program thinks it owns the entire memory –> the virtual address space.

Virtual addresses are translated to physical addresses by the OS and hardware.

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

Swap space is located in which memory?

A

Secondary.

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

What is a page?

A

The equivalent to a block of virtual memory. Page sizes tend to be 4-16 KB.
Mapping is done through a page table.

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

Does a cache or physical memory have a higher miss rate?

A

Cache.

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

A virtual address is divided up into what parts in a page table?

A

Virtual page number (equivalent of tag) and page offset.

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

Does virtual memory use write-through or write-back?

A

Write-back

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

How does the computer know where the page table for a program is stored?

A

The start of the table is pointed to by the page table register.

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

Why is no tag required for a page table?

A

Each page has its own mapping.

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

What acts like the index in a page table?

A

The full block address (virtual page number)

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

Describe how a virtual address is translated into a physical address.

A

The first 20 bits of the virtual page number is the index of the page table. The 18-bit address at that entry is the physical page number.

The last 12 bits are the offset, and are kept the same.

The physical page number is added to the front of the offset to get the physical address.

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

What is the size of the page table given a 32-bit virtual address space, 4 KB physical pages and 1 GB of main memory?

A

4 KB = 4000 B, so 12 bits are required for offset.
Then, we have 20 bits for virtual page number.

1 GB = 1,000,000,000 B, so 30 bits are needed for the physical address. We therefore have 18 bits for virtual page number.

There are 220 entries in the table with 18 bits required for each.

Thus, 18*220 bits = 2.25 MB

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

What are the ARM special bits in a page table?

A

Access (set when the page is accessed, and reset periodically)
Modified (set if data needs to be written back to disk)
Residence (set if page table is in memory)

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

What bits control the permissions of a particular entry in a page table?

A

W (read & write)
R (read only)
X (execute only)

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

What is the only manager that can edit a page table?

A

Operating System.

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

Why is a sole page table too slow to be useful?

A

There are two memory accesses required - one to look up the address and one to load/store.

17
Q

What is a TLB?

A

A TLB (Translation Lookaside Buffer) is a cache of page table entries.

The tag is the virtual page number, and physical page number is the entry.

18
Q

What are the 5 TLB status bits?

A

V (Valid)
D (Dirty)
R (Read)
W (Read & Write)
X (Execute)