Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Active Tutors
Asked Questions
Answered Questions
how do we keep track of where the free pieces of memory are one idea is to maintain a set of linked-lists of free space each linked-list will store
since most of the programs require a lot of memory allocationdeallocation we expect the memory management to be fast to have low fragmentation make
usually memory is allocated from a large pool of unused memory area called the heap in c dynamic allocationdeallocation must be manually performed
the question of fairness regarding page eviction is a hard one how do we decide what is fair many operating systems use global lru where pages from
now let us discuss two related algorithms for deciding which pages to evict the clock algorithm is one of the most popular choices it works by
1 on every access mark the page with a timestamp whenever we need to evict a page we search through memory for the oldest page the least-recently
evicting the most-recently used mru page does very well on lrus worst case in general however mru is a bad idea since many programs exhibit temporal
lru evicts the page which was last accessed the farthest into the past of any page resident in physical memory ie the least-recently used page lru
the optimal replacement policy called opt is to evict the page which will be accessed farthest into the future since we cant predict the future
the physical memory acts as a cache backed by the disk when the physical memory is full and we want to read in another page from disk we have to
processes have valid and invalid entries on their page tables the valid entries all point to some where real eg a physical page or some portion of
as we have discussed page tables map virtual page addresses to physical page addresses one of the advantages of using virtual addresses is that we
suppose your process starts up and allocates some memory with malloc the allocator will then give part of a memory page to your process the os then
when do we write a page from physical memory back to the diskin general caches have two broad types of writing policies one approach is a
for reading most operating systems use demand paging this means that pages are only read from the disk into physical memory when they are needed in
we will briey introduce paging to nish off this lecture when a process is loaded not all of the pages are immediately loaded since its possible that
how exactly is a page table used to look up an addressthe cpu has a page table base register ptbrwhich points to the base entry 0 of the level-0 page
multi-level page tables are tree-like structures to hold page tables as an example consider a two- level page table again on a 32-bit architecture
as mentioned above page tables are lookup tables mapping a process virtual pages to physical pages in ram how would one implement these page
virtual addresses are made up of two parts the rst part is the page number and the second part is an offset inside that page suppose our pages are
when a program issues a memory load or store operation the virtual addresses vas used in those operations have to be translated into real physical
using pages makes it easier to manage the whole memory avoiding excessive fragmentation and waste as an analogy think of tetris but with only square
applications allocate memory in terms of the number of bytes that they need but this level of granularity is too ne-grained for the operating system
in modern operating systems applications do not directly access the physical memory instead they use so-called virtual memory where each virtual
while it is hard to resolve a deadlock which has been detected fortunately it is fairly easy to prevent deadlocks from ever happening the key is that