virtual memory Flashcards

1
Q

how does virtual memory work

A

to give us more memory we use main memory as a cache for the disk/swap space

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

swap space

A

contains all the pages corresponding to the process whilst only some of them are in main memory

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

where do we store the control information

A

in the spare 12 bits in the page pointer obtained from the page directory

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

what are some examples of the information in the control information section

A

dirty flag
accessed flag
present flay

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

what does the dirty flag show

A

if the frame is currently different to the one on the disk
means that if we need to free that space then we need to store it to the disk first

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

what does the present flag show

A

if the frame is actually in memory

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

what does the accessed flag show

A

if the frame has been accessed whilst its been in memory

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

what are the steps to replacing a frame ( getting it from the disk)

A

we get a page fault
we choose a victim and update the disk if the dirty flag is set
we remove the old translation and drop the frame from memory
the new frame is added to the place of the old frame and the new translation is mapped
the process is restarted

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

in which two ways do we choose how many pages to allocate per process and explain them

A

equal allocation: equal number of pages per process
proportionate allocation: based on the process size

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

why does equal page allocation not make sense

A

because each process has different requirements

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

thrashing

A

when a process doesnt have enough frames

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

what are the two negatives of thrashing

A

high number of page faults
lower cpu utilisation as time is spent paging in and out which is expensive

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

how does thrashing cause a high number of page faults

A

not enough frames are allocated
not having enough memory and having too many frames on the disk

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

how can we limit thrashing

A

local replacement algorithm: stops a process from being able to take frames from other processes therefore thrashing is limited to the one process

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

in which two ways can we speed up page replacement

A

always keeping a frame free
maintain a list of victim frames

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

how does always keeping a page free speed up page replacement

A

theres always a page free to be replaced and when its used then the next victim is moved to the disk and their frame is made free

17
Q

how do we maintain a list of victim frames to speed up page replacement

A

during idle time the os writes the victim frames to the disk
if a process goes back to a frame on the list we can recover it and add it back to main memory (soft page fault)

18
Q

soft page fault

A

the frame isnt part of the page table but its till in memory and not been overwritten

19
Q

hard page fault

A

the frame is only on the disk

20
Q

working set

A

the pages that the process would want in memory
but not necessarily in memory

21
Q

resident set

A

pages actually in memory

22
Q

page reference string

A

list of pages accessed over a period of timeu

23
Q

maximum resident set

A

max pages at a given time (peak memory usage)

24
Q

what is the issue with fifo page replacement algorithm

A

the first pages usually hold key parts of the process e.g. global variables

25
in which two ways can we keep a record on when each frame was last used in the least recently used page replacement algorithm
keep a count of the number of accesses have a doubly linked list of frames: when a frame is accessed it goes to the top so all victim frames are at the bottom
26
what is the negatives of using the least recently used algorithm in page replacement
requires additional hardware which is expensive
27
what are the four page replacement algorithms
least recently used fifo least frequently used second chance/clock algorithm
28
how does the second chance/ clock algorithm work
the frames are in a circular list when we get a page fault we go round until we found a frame with an accessed bit still at 0 which we can overwrite when going round, all the frames with the access bit set to 1 are set to 0 so that if there were initially no 0 when we go round again then we have a victim
29
what is the role of the clock hand in the clock/second chance algorithm
the "clock hand" is a pointer to the next victim to keep track of the order ensuring we dont start form the beginning each time
30
how does the least frequently used algorithm work in page replacement
we have a timer that trigger us to look at the access bits of all frames of the process and push them onto the shift register the frame with the lowest value is the one that has been least frequently used
31
in the least frequently used algorithm in page replacement what does the number of bits in the shift register define
defines the working set period e.g. triggered every ms, 4 bits = 4ms working set period
32
in the least frequently used algorithm in page replacement what does it mean when all the bits are 0 in the register
the frame is not in the working set so a likely victim
33
what does it mean when a process has a low page fault frequency
working set is too large has more frames than necessary
34
what does it mean when a process has a high page fault frequency
working set is too small which leads to thrashing (not enough frames)
35
how can we deal with a process with a high page fault frequency
can pause it and push it to the disk then allow another process to complete before resuming to stop the thrashing