Paging (5+6) Flashcards
Advantages of partial loading
many processes can concurrently be maintained in main mem (only a few pages for each processes)
Allows users to execute many programs and large data structures at once without worrying about filling up main memory
more processes = efficient utilization of CPU
Page
small chunk of memory that constitutes a small part of the total memory needed to execute a process - one process may have many pages
Page table
look up table used by MMU to decide how many pages should be swapped in and swapped out of main mem
name and explain the 2 different parts of the MMU used in memory translation and assignment
Virtual memory manager - retrieves processes in secondary storage for transfer
Page table translates VA to PA - page table hard coded into cache mem and only accessible by OS kernel
What are the three things that can happen when a process at a VA is translated to a PA
- Physical address is assigned to process by page table
- Memory page is not accessible to MMU as it is still in secondary storage
- Nothing - VA is invalid
Demand paging
pages are allocated (on demand) to free frames in main memory
“on demand” means that when a process is scheduled to run, then the memory pages (needed by process to run) will be allocated to free frames in main mem - no free frames, pages of other process will be eviced to create free space “frames”
how does the MMU accomplish the “illusion” that each processes has access to all the required phys mem space?
MMU uses demand paging - pages most in demand are swapped in and least demanded pahes are swapped out. Priority processes are kept in temp mem cache for fast access and retrieval
Context switching
process of swapping in and out parts of a process between VM and PMem
What does context switching allow the OS to do?
OS can keep active portions of multiples processes in main mem while the rest of the process is in VM
when does context switching happen
when we switch between user and kernel operations - when we need to let the OS swap a process into main mem for execution or to suspend it.
Context switch is an OS level software interrupt
Each process is allocated memory that is comprised of
code - compiled source code
data - any data e.g. external files used by the process
stack - used for static memory allocation
heap - dynamic mem allocation
this is the process address space
Difference between stack and heap regarding position
stack - starts at max logical position and grows down
heap - starts at min logical position and grows up
What is stack
region in mem that stores temp variables created by each function in a program - LIFO
When function exits variables are freed - now available for other stack variables
advantage of stack
memory is managed for the user - doesnt have to free or allocate it
Heap
not managed automatically
larger free-floating region in memory
need to use malloc() or alloc() and free( )