Virtual memory Flashcards

1
Q

What do most virtual memory systems use?

A

paging

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

what is the basic idea of virtual memory?

A

combined size of a program likely to exceed memory available for it.
So, chop it up and have parts in use in memory, and the other parts on disk.

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

What is another term for a programmed address?

A

virtual address

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

Virtual addresses form [x]

A

virtual address space

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

On computer without virtual memory, [x]

A

virtual address is put directly onto memory bus and physical word is read or written

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

When virtual memory memory is used [x]

A

virtual addresses go to an MMU

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

The MMU [x]

A

maps virtual addresses onto physical addresses

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

The virtual address space is [x] into units called [y]

A
x = divided
y = pagees
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The corresponding unit in actual memory from a page is called the

A

page frame

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

What is important about size of pages to page frames?

A

They are exactly the same

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

When a program tries to access address 0, what happens?

A

Virtual address - sent to MMU
MMU sees that virtual address falls on a page number
That page number maps to page frame 2 which has a physical address [y]
It outputs physical address [y] onto the bus

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

What keeps track of which pages are physically present in memory?

A

Present/absent bit

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

What happens if a page is not mapped?

A

MMU notices and causes the CPU to trap.

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

What is a CPU trap called in the instance of not finding a page mapping?

A

page fault

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

What happens after a page fault?

A

1) Operating system picks a page, writes its contents to disk.
2) It then fetches the references page and writes it to the page frame just wiped.
3) It changes the mapping
4) It restarts

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

What is the purpose of the page table?

A

map virtual pages onto page frames.

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

How many page tables are created?

A

As many page tables as there are processes.

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

Why does each process need its own page table?

A

Because each process has its own virtual address space

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

What is the most important field in a page table?

A

Page frame number

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

What fields are in a page table?

A
Page frame number
Present/absent bit
Protection bit
Modified bit
Referenced bit
Caching disabled bit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What does protection bit describe?

A

The permissions associated with the page

22
Q

What does the modified bit describe?

A

If a page has been used and modified.

23
Q

If a page has been modified, what must happen if it is being replaced?

A

It must be written back to disk.

24
Q

What does the referenced bit do?

A

It helps the operating system understand if the page is being used or not.

25
Q

Why is the disk address not part of the page table.

A

Simple. The page table is about mapping virtual to physical.

26
Q

Where is information about faults kept?

A

In the operating system.

27
Q

What is a TLB?

A

Translation lookaside buffer

28
Q

What is a TLB

A

A fast cache-like item usually in the MMU.

29
Q

Where does the TLB come from?

A

The understanding that most programs tend to make a large number of references to a small number of pages

30
Q

What does the TLB allow?

A

The mapping of virtual addresses to physical address without going through the page table

31
Q

What is included in a TLB entry?

A

Information about one page:

1) virtual page number
2) a modified bit
3) protection code
4) the physical page frame in which the page is located
5) referenced bit

32
Q

What kind of correspondence exists between the TLB and the page table?

A

One to one.

33
Q

What happens when virtual address is presented to the MMU

A

1) IT checks the TLB.

2) If in TLB, it just loads page straight from there without going to page table.

34
Q

What happens if a virtual page number is not in a TLB?

A

The MMU sees the TLB miss, does a page table lookup.
It then evicts an item from the TLB and loads that page in.

If TLB and page table miss, it has to load it into page table and also into TLB.

35
Q

What are the common algorithms for replacing pages?

A
Not recently used
First in first out
Second chance
Clock page
Least recently used
Working set page
WSClock
36
Q

Basics for not recently used?

A

on page fault, operating system checks 4 fields based on reference and modication

not referenced, not modified
not referenced, modified
referenced, not modified
referenced, modified

when a process is started, both r and m bits set to 0. Periodically (clock interrupt), r bit is cleared. M bit changes if it has been referenced.

37
Q

Basics for first in first out

A

it’s a queue.

at the head (the oldest) item is removed.

38
Q

Basics for Second Chance Page Replacement algo

A

Modifies FIFO
Rather than throwing out a heavily used old page, the referenced bit is checked.

If r = 0, it is old and unused = remove.
If r = 1, r is reset and it is put to the end of the queue and treated like a new page.

39
Q

Basics for clock page replacement algo?

A

Like second chance, but keeps things on a circular list with a pointer (like a hand).

When page fault occurs, the page being pointed at is inspected.

If page = 0, page is evicted.
If page = 1, the R bit is cleared and hand moves.
Process continues until a 0 is found to be able to do a replacement.

40
Q

Basics for least recently used algo

A

Idea stems from notion that something that’s in use or has been used recently will likely be used again.

41
Q

What is a problem with least recently used algo?

A

It’s expensive.
Must keep a linked list of all pages. Most recently used page must be kept at front of list.
List constantly updating.

42
Q

The set of pages that a process is currently using is called its [x]

A

working set

43
Q

Working set is defined as

A

The set of pages that a process is currently using

44
Q

Thrashing is defined as

A

a program causing page faults every few instructions

45
Q

Define demand paging

A

When pages are loaded on demand, not in advance.

46
Q

What is the working set model?

A

An attempt to keep track of working set to greatly reduce page fault rate

47
Q

Define prepaging

A

Loading pages before the process is allowed to run.

48
Q

Why does it matter that the working set changes slowly?

A

Because you can make a reasonable guess at which pages need loading in when a program restarts.

49
Q

what do you need to be able to do to implement a working set model?

A

You need to be able to keep track of the pages that are being used.

50
Q

Where does working set page replacement algorithm come in then?

A

When a page fault occurs, find a page not in the working set of the particular program that’s being worked on and evict it.

51
Q

Algorithm for working set page replacement basics:

A

Reference and modified bits are in as standard, as is a clock which clears reference bit every interrupt.

On page fault, everything checked. If R = 1, current virtual time is written into TIME OF LAST USE field = page was in use since last page fault. This means it is part of working set.

If R = 0 and TIME OF LAST USE is greater than the current virtual time, then you can evict

If R = 0 and TIME OF LAST USE is less than current virtual time, it will be temporarily spared.

52
Q

Define current virtual time

A

The amount of CPU time a process has actually used since it started