13 - Address Spaces Flashcards
What is the VM system responsible for?
providing the illusion of a large, sparse, private address to each running program
What does each virtual address space contain?
All of a program’s instructions and data
What does the OS do with each virtual memory reference?
Turn them to physical addresses
What is presented to the physical memory in order to fetch or update the desired information?
Physical addresses
What is multiprogramming?
multiple processes are ready to run at a given time, and the OS can switch between them.
Name a benefit of multiprogramming.
increased effective CPU utilization which lead to increase efficiency
Name optimal way to implement time sharing
leave processes in memory while switching between them, allowing the OS to implement time sharing efficiently
Name something about protection
Talk about what you want or don’t want a process to do
You don’t want a process to be able to read or write some other process’s memory
The easy to use abstraction of physical memory is also known as?
Address space
What is the running program’s view of memory in the system?
Address space
What is the ‘code’ of the program otherwise known as, and where is it?
the instructions of the program and they are in the address space
What data structure does the running program use and for what? (First one mentioned)
A stack. Keep track of where it is in the function call chain as well as to allocate local variables and pass parameters and return values to and from routines
What data structure does the running program use and for what? (Second one mentioned)
A heap. for dynamically-allocated, user-managed memory
What are three components in an address space?
code, stack, heap
Is code static or dynamic, and what are the perks of it?
Static. Easy to place in memory and can place it at the top of the address space and know that it won’t need any more space as the program runs.
Are stack and heap dynamic or static and where are their locations, respective to each other?
Both are dynamic. Heap is above stack. Stack is below heap.
What about heap and stack’s growth?
They have to grow in opposite directions. Heap grows downward while stack grows upward.
Can stack and heap be placed differently?
Yes, when multiple threads co-exist in an address space, dividing the regions nicely like this won’t work anymore
When processes are loaded into memory at different addresses, what is the OS doing?
Virtualizing memory. The running program thinks it is loaded into memory at a particular address and has a potentially large address space. The reality is different.
What if a process tries to perform a load at a virtual address?
Somehow the OS, along with hardware support, will have to make sure the load doesn’t actually go to the physical version of the virtual address but rather the physical address of where the process is loaded into memory.
What are the three goals of virtual memory?
Transparency, Efficiency, Protection
In Transparency, how does the OS implement virtual memory and how should the program behave?
In a way that is invisible to the running program. The program should behave as if has its own private physical memory.
In Efficiency, on what terms should the virtualization make as efficient as possible and what will the OS rely on?
time(not making programs run more slowly) and space(not using too much memory for structures needed to support virtualization). The OS will have to rely on hardware support, like TLBs
In Protection, what should the OS makes sure to do and what property does the OS deliver to each process?
The OS makes sure to protect processes from each other and the OS itself from the processes. When a process is in action, it should not be able to access or affect in any way the memory contents of any other process or the OS itself. The OS delivers ISOLATION among processes.
What is a key principle of building reliable systems?
Isolation
What kernels are used in Isolation?
Microkernels