all in all, it's not an elegant way to expose physical memory to processes.
a better solution is to invent a concept:address space.
the simplest way to implement it is base and limit registers.
keeping all the processes in memory all the time cannot be done and can be solved by swapping(bring the process in its entirety,running for a while,and putting back to disk)or virtual memory(allow process to run even when they are partially in main memory).
as for managing free memory,there are two ways,bitmaps and free lists.
virtual memory always goes with paging.
MMU holds a map-table(so page table is needed by hardware,but the information the OS needs to handle page fault is kept in software tables in OS and hardware does not need it).
each process has its own page-table.
TLB(Translation Lookaside Buffer)(hardware optimization,TLB is usually inside the MMU)(also can be software implementation,usually in RISC CPU).
multilevel paging is used to reduce the size of the page table kept in memory.
in order for memory sharing, actually each process has two page-table pointers.one for instruction and one for data.when the scheduler chooses a process to run,it uses thess pointers to locate appropriate page-tables and set the MMU to use them.
shared libraries(DLL in Windows)
more detailed,keeping a supply of page frames around yields better performance than using all of the memory and then trying to find a frame at the moment it is needed,so a background process called paging daemon is invented.
the swap space in disk:
separate from the file system
没有评论:
发表评论