virtual memory Flashcards
how does virtual memory work
to give us more memory we use main memory as a cache for the disk/swap space
swap space
contains all the pages corresponding to the process whilst only some of them are in main memory
where do we store the control information
in the spare 12 bits in the page pointer obtained from the page directory
what are some examples of the information in the control information section
dirty flag
accessed flag
present flay
what does the dirty flag show
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
what does the present flag show
if the frame is actually in memory
what does the accessed flag show
if the frame has been accessed whilst its been in memory
what are the steps to replacing a frame ( getting it from the disk)
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
in which two ways do we choose how many pages to allocate per process and explain them
equal allocation: equal number of pages per process
proportionate allocation: based on the process size
why does equal page allocation not make sense
because each process has different requirements
thrashing
when a process doesnt have enough frames
what are the two negatives of thrashing
high number of page faults
lower cpu utilisation as time is spent paging in and out which is expensive
how does thrashing cause a high number of page faults
not enough frames are allocated
not having enough memory and having too many frames on the disk
how can we limit thrashing
local replacement algorithm: stops a process from being able to take frames from other processes therefore thrashing is limited to the one process
in which two ways can we speed up page replacement
always keeping a frame free
maintain a list of victim frames
how does always keeping a page free speed up page replacement
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
how do we maintain a list of victim frames to speed up page replacement
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)
soft page fault
the frame isnt part of the page table but its till in memory and not been overwritten
hard page fault
the frame is only on the disk
working set
the pages that the process would want in memory
but not necessarily in memory
resident set
pages actually in memory
page reference string
list of pages accessed over a period of timeu
maximum resident set
max pages at a given time (peak memory usage)
what is the issue with fifo page replacement algorithm
the first pages usually hold key parts of the process e.g. global variables