Memory Multiplexing (3+4) Flashcards
two main approaches to multiplexing in an OS
multiplex CPU operations - schedule to run concurrently on single processor
memory mult - use v mem to enable many processes to share phys mem
reason for multiplexing
limited hardware resources
Explain the concept of protection in memory MUX
2 or more processes cannot accidently overwrite each others data
Example of memory protection
kernel data being protected from user program data
a specific range of physical memory addresses is reserved for kernel data only and not user data
Explain the notion of controlled overlap
The overlapping of concurrently running process needs to be controlled for protection to be implemented properly - mechanisms needed
Explain the concept of translation in memory MUX
mapping from virtual addresses to physical address
RAM uses physical addresses and CPU uses virtual addresses giving it access to all programs that need to be run
What are the different types of memory found in the memory hierarchy?
CPU registers, cache, Ram, disk
What is cache memory in the OS context
computer memory with very short acces time used for storage of frequently used data or instructions
Issues that arise with memory translation
many virtual addresses, few physical addresses - OS needs to map to a valid physical address that is free
Issues that arise with memory assignment
Assigned phys mem space must be free and large enough for the chunk but not too large
Issues that arise with memory protection
Processes must not access same address at same time - must not overwrite each other - process 1 must execute before being swapped out
Issues that arise with memory sharing
n processes share same address in phys mem
Problem - n processes must be divided properly so that each process is assigned phys mem and that equal processes share phys address - must be protected from each other
Explain the notion that a process doesnt need occupy continuous mem spaces
Process in Vmem is swapped into main memory - can be in pieces.
Process referenced by virtual memory can be swapped into main mem and executed bit by bit
Explain the role of the CPU in generating physical addresses
Addresses generated by cpu point directly to bytes is phys mem - when CPU assigns an executing process to physical memory, the process is assigned a chunk of memory that comprises of data words
Define words in the OS context
fixed size data chunks
What does it mean for a phys memory space to be valid
large enough and free
What is the MMU used for
address translation
Briefly explain what happens in a VA to PA translation
MMU checks cache, maps VA to PA so that processes referenced by VA can be loaded into the phys mem at the PA
Issue that arises with use of translating between VA and PA
physical memory access conflicts - 2 or more VA map to same PA
First part of solution to physical memory access conflicts
OS needs to make sure that different VA space is used to address the memory needed to run every process that has been scheduled to run - each process has different VA?
Pages?
Memory chuncks that processes are broken into
program vs process
program - code, libraries, data needed to run
process - program executable running
What is exe.
processes that has been scheduled to run by the OS and is currently suspended or running
Machine code instructions that incorporates everything needed to run the process
Processes stack
executables scheduled to run by OS
stores in VMem and loaded into main mem bit by bit
VAS
Virtual address space where process stack is stored - many pages of memory in secondary storage
Describe the process of compiling a program into an exe
Build - removes comments, adds header file (if macros used, they will be replaced with code). Compiler will take the code and generate assembly code. Assembler converts assembly into object code (machine code). Linker links machine code with library function code. Merges other code into one exe file. Load exe into main mem
Explain dynamic linking
Delays the resolving of some undefined symbols to runtime. Executable code will still have some undefined symbols and list of libraries that will provide definition for said symbols. Load the program will load these libraries
Explain the use of stub code in dynamic linking
locates memory-resident library at run time - where the stub (executable code) replaces itself with the library address and executes the library at the address
Explain static linking
Linking of libraries done at compile time
Linker or link editor
programming language utility program that takes one or more object files generated by a compiler and combines them into a single executable file, library file or object file
Paging
deciding which pages to swap into and out of main memory
page table
holds mapping function
page replacement algorithm
decides which pages to swap into and out of main memory
What is loading into memory for execution
process with own kernel and process virtual memory parts. Kernel part contains: OS specific libraries and toher data that must be execited
Virtual memory parts: memory chuncks each storing a specific part of the process where chunks are stacked on top of each other
What is uni-programming
No translation or protection - only one process runs a time and a process always runs at the same main mem space but can access any main mem address
What is multi-programming
original concept of multiprogamming
each process allocated a specific space in main mem but no translation or protection - linker and loader dynamically adjusted program addresses when they were loaded to prevent overlap
Issue with original concept of multiprogamming
no protection - bugs in one program could cause another process to crash
What is multi-programming with protection
Two special CPU registers to enable process protection without translation
BaseAddr and LimitAddr prevented users from straying out of allocated memory addresses - if a user program tried to access illegal address - cause error and process would not execure