memory protection Flashcards
how does base and limit work
each process has a base and limit for the memory addresses its allowed to access
whenever we want to go to memory to access something we check that the address is between the base and limit
what is a benefit of base and limit
easy to handle as we just need two registers one for the base and one for the limit
logical address
the address that the program is written to/ the process sees
physical address
where the process is actually stored
in base and limit how do we calculate the physical address
base + logical address
what is a negative of base and limit
we assume that programs start at 0 in memory so depending on when the process is loaded youll get a different set of memory addresses for it and wont know what the values will be
relative addressing
writing programs so memory access is relative to the memory address
what is a negative of relative addressing
awkward and messy
in which two ways can we solve the problem of base and limit making programs start at an arbitrary value
relative addressing
dynamically remapping addressing from logical to physical
what does the memory management unit do
contains the mappings
contains the logic for checking if an address is valid
how does the mmu get the correct address and what does it do if the address is incorrect
we check if the logical address is less that the limit
if so we add the base value and that gives us an address within the process
if its > or == the limit then we get an address error
how does segmentation work
logical addresses are stored as the segment number and the offset
the segment number is the index of the segment descriptor table which gives us the base address and the limit
we check if the offset is < the limit
if yes then we add the offset to the base to give us the physical address
what is a positive of segmentation
provides protection to processes and the segments allowing us to have different permissions per segment
segment
the logical elements that a process can be broken into which can have different permissions
segment descriptor table
stores the base and limit of each segment
segment number
index for the segment descriptor table
what does paging do to memory
divides it into blocks
what are two benefits of paging
memory is now in blocks making it easier to manage
makes memory management more flexible and efficient
page
logical block
frame
physical block
page number
index for page table
page table
maps a logical page to a physical frame
what does the logical address for paging contain
the page number and the offset
how does paging work
the logical address points to the page in the page table which maps to the frame in memory
the offset is used to find the specific byte needed in that page
how does shared memory work with paging
different virtual addresses can have the same frame therefore both processes are communicating with the same block
what is a benefit of shared memory and paging
can access the same block allowing things like shared libraries
how does paging make memory management more efficient and flexible
translation allows two processes to have the same logical address but map to different physical addresses therefore it looks like we have more space available as we can swap pages between the disk and memory