Virtual Memory Flashcards

1
Q

Virtual Memory Idea

A

Separation of user logic memory from physical memory

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

With virtual memory, only

A

part of the program needs to be in memory for execution

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

Logical address space can be much _ than physical address space

A

Larger

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

What 2 things does virtual memory allow

A

Address spaces to be shared by several processes
More efficient process creation

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

Virtual Memory Goals 2

A

Make programmer’s job easier
Enable multiprogramming

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

What two ways can virtual memory be implemented?

A

Demand paging
Demand segmentation

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

Demand Paging

A

Bring a page into memory only when it is needed

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

Benefits of demand paging 4

A

Less I/O needed
Less memory needed
Faster response
More users

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

Page has invalid reference vs not in memory

A

Abort, bring to memory

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

What is valid/invalid bit?

A

In each page table entry, 0: not in memory or invalid, 1: in memory and lega. Initially all bits are set to 0 on all entries

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

What happens if a valid/invalid bit in a page table entry is 0 during address translation?

A

It will be considered a page fault and execution will be handed to OS

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

What happens if there is ever a reference to a page not in memory?

A

First reference will trap to OS (page fault)
OS needs to see if it is invalid reference (abort) or valid but not in memory (swap in)

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

Valid reference but not in memory steps

A

Get empty frame,
Swap (read) page into the new frame
Set the page table, and validation bit=1
Restart instruction

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

What happens if there is no free frame?

A

Page replacement: find some page that resides in memory, but is not really in use, swap it out to free up space

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

How to prevent over-allocation of memory?

A

Modify page-fault service routing to include page replacement

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

What is (dirty) bit used for?

A

Reduce overhead of page transfers. Only modified pages are swapped out (written to the disk)

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

What do we want from page replacement algorithms?

A

Lowest page fault rate

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

Reference string

A

String of memory references

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

Belady’s Anomaly

A

More frames lead to more page faults

20
Q

Belady’s optimal algorthm

A

Provably optimal with lowest fault rate
But need to know the future

21
Q

Is there a best or worst page replacement algorithm?

A

No

22
Q

Page replacement simple steps

A
  1. Find location of the desired page on disk
  2. Find a free frame (use page replacement algorithm if no free frame)
  3. Read the desired page into the newly free frame. Update the page and frame tables
  4. Restart the process
23
Q

Why is Beladys algorithm useful?

A

As a reference to compare other algorithms

24
Q

Why is FIFO good

A

Maybe the page brought in longest ago is not being used

25
Q

Why is FIFO bad

A

Maybe the one brought a while ago is being used

26
Q

Least Recently Used

A

Replace the page that has not been used for the longest amount of time in the past

27
Q

LRU idea

A

Past experience gives us a guess of future behavior

28
Q

Stack implementation LRU

A

Keep a stack of page numbers in a double link form, when page is referenced, move it to the top

29
Q

Approximation implementation LRU

A

Set a reference bit to 0 for each page/frame. When page is referenced, set to 1. Replace the one which is 0 (if one exists) however, we do not know the order

30
Q

Additional reference bits LRU

A

1 byte for each page/frame, shift right at each time interval

31
Q

LRU Clock/ Not Recently Used/Second Chance

A

Replace page that is old enough

32
Q

LRU Counting Algorithms

A

Least Frequently Used - Replaces page with smallest count
Most Frequently Used - Smallest count was probably just brought in and has yet to be used

33
Q

Clock, when page is brought in, reference bit is set to

A

0

34
Q

What happens if a process does not have enough frames?

A

The page-fault rate is very high which will lead to a replacement of active pages which will be needed soon again

35
Q

When does thrashing happen?

A

When a process is busy swapping pages in and out

36
Q

What does thrashing cause?

A

low CPU utilization

37
Q

When does thrashing occur? high level

A

When a computer’s virtual memory resources are overused

38
Q

What might OS think if it sees low cpu utilization?

A

It needs to increase degree of multiprogramming, which is adding another process, which results in even less cpu utilization

39
Q

If CPU utilization is 96 percent and disk utilization is 4 percent, can you increase the degree of multiprogramming to increase the CPU utilization?

A

CPU utilization is sufficiently high to leave things alone, increasing the degree of multiprogramming may decrease the CPU utilization

40
Q

If CPU utilization is 10 percent and disk utilization is 95 percent, can you increase the degree of multiprogramming to increase the CPU utilization?

A

No, thrashing is occurring, you are constantly swapping in and out with high disk utilization

41
Q

If CPU utilization is 12 percent and disk utilization is 2 percent, can you increase the degree of multiprogramming to increase the CPU utilization?

A

yes

42
Q

CPU utilization: 18%
Paging disk: 96%
Other I/O: 6%
Will installing a faster CPU improve cpu utilization?

A

No, a faster CPU will reduce utilization since the CPU will spend more time waiting for a process

43
Q

CPU utilization: 18%
Paging disk: 96%
Other I/O: 6%
Will installing a bigger paging disk improve cpu utilization?

A

No, the size of the paging disk does not affect the amount of memory that is needed to reduce the page faults

44
Q

CPU utilization: 18%
Paging disk: 96%
Other I/O: 6%
Will decreasing the degree of multiprogramming improve cpu utilization?

A

Yes, by suspending some of the processes, the other processes will have more frames in order to bring their pages in them hence reducing the page faults

45
Q

CPU utilization: 18%
Paging disk: 96%
Other I/O: 6%
Will installing more main memory improve cpu utilization?

A

Likely, more pages can remain resident and do not require paging to or from the disks (dependent on page replacement algorithm)