paging Flashcards
why do we create a hierarchy of page translations (multilevel paging)
v few processes will require access to every single page in the system so we only store the ones currently in use for the process
what does the address look like for multilevel paging
upper bits = index to page directory
next set of bits = index in the page table (which shows the frame number)
lower bits = offset in the frame
what does the page directory contain
pointers to the next level of pages in the hierarchy
in a 32 bit machine using multilevel paging how are the address bits split up
10 = page directory
10 = page table
12 = offset
what are 2 negatives of using 64 bit architecture
requires much larger pages
inefficient due to internal fragmentation
how can we make 64 bit architectures with multilayer paging more efficient
not letting the hierarchy get too deep and therefore having larger page sizes
what are two alternatives to 64 bit architecture with multilayer paging
hashed page tables
inverted page tables
how do inverted page tables work
the table has one entry for each frame and one table is used for all processes
the process id is included in the address and a search if done with the pid combined with the page number
the position in the table if the frame number
what is a positive fo inverted page tables
reduces the number of memory accesses and transaltions
what is a negative and positive of hashed page tables
more expensive access however if there are few entries in the list then its more efficient than going through all the hierarchies in a 64 bit machine
how do hashed page tables work
the page number is hashed which represents the index to a smaller page table
the table stores a pointer to a list of page table entries with the same hash value
the list is scanned for the page number we want
what is the point of demand paging
allows you to add more pages to a process whilst its running
how does demand paging work
a process initially hasno memory
every time a process tries to access an area of memory without a translation in the page table, you get a PAGE FAULT
if the operation is illegal then the process is stopped
if legal then we allocate more memory to the process, which adds another page to the table and we rerun the last instruction ( the one that caused the page fault)
what causes a page fault
when a process tries to access an area of memory without a translation in the page table
what happens when you get a page fault
an interrupt is called and the page fault interrupt handler is invoked
how does demand paging allow scalability
every time the process accesses a new page, we can add the into the mapping for the process
what is a benefit of shared memory
dont have to duplicate libraries for multiple processes and instead just map the translations to the same memory location
what are the permissions for a shared library
r x
what is the role of the translation lookaside buffer (tlb)
a hybrid of memory and hybrid based page tables which is a cache of mappings
what are the pros and cons if register based page tables
fast but limited capacity as registers are expensive
what are the pros and cons if memory based page tables
the capacity is only limited by memory
slow access time as its also translated via tables
what is the benefit of tlb
locality so faster access
how does the tlb work with multiple processes
we store the process id with each entry so when we get a tlb hit we make sure to also match the pid
why do we want to use the tlb with multiple processes
so that we dont have to flush the cache each time we switch processes as translations are only valid per process
how does retrieving a frame from the tlb work
if the page number is stored then we have a tlb hit so we get the frame number
if its a miss then we simply get the frame the way that we usually would then insert the entry into the tlb
how do we speed up the creation of new processes
when we create a child process we duplicate the page tables so the child shares all the same mappings as the parent
we mark all pages as read only (but remember which were writable)
whenever the parent/child tries to execute we get a PAGE FAULT
we then duplicate the memeory corresponding to the frame thats being accesses
we return the permissions but now the parent and child can write to different frames
how do we remember which pages were writable when creating a new child process
using a spare bit in the page table
what is the benefit of “speeding up” creating a new process
we only incur overhead of copying new memory when we actually need to execute / write something
why do we need to “speed up” creating processes (old method)
when we create a child, we call exec() immediately after which replaces all the child’s processes with the one of the application
therefore we are simply duplicating the parent just to throw it away