Introduction to Memory Management
Notes
- We have just seen how processes can share a "cpu"
- How do they share memory?
- That is the topic of the next section.
- Like everything else, we will view a historic development of memory management.
- Memory is
- A large array of bytes.
- One single thing, not data memory and instruction memory for example.
- In general, we are talking about ram
- Registers are managed by the program and protected in a context switch.
- CACHE is mostly automatically controlled and out of the hands of programmers
- Hard drive space (auxiliary storage in general) is too slow, but will come into play eventually
- The trend over time is for cpu speed to greatly outpace memory speed
- A descriptive article.
-
from Anand Mirji (medium.com/@abab,nurhu)
- Processors in the GHz (low )
- Memory in MHz (High)
- Memory is getting faster, but there are still latenicies involved.
- But a second issue is that memory must be protected.
- We can assume that early programs had access to full memory
- Later the OS and service routines were loaded into memory and kept memory resident.
- So we needed a way to control program access to memory
- Currently the MMU
- Contains a base register and a limit register
- The base register points to the lowest point in memory the program can access
- The limit register points to the highest point.
- Access between the base register and limit register is unrestricted
- Access outside of this space requires OS permission
- So
- These two registers can only be changed in kernel mode
- Become part of the context of a process
- Determine the memory the program can access or the bounds of a program's memory
- See figures 9.1 and 9.2 (351 and 352)
- A program thinks that it is addressing memory from 0 on
- But the MMU can adjust by adding the base register value to addresses to obtain the physical address.
- The original address is called the logical address
- See Figure 9.4, p 354.
- And we might call the base register the relocation register.
- By the way, they take a side trip into linking and loading
- Address binding
- Compilers can produce absolute code when they know where labels will be loaded
- Compilers can produce relocatable code when they do not.
- A linker/loader will resolve these addresses when linking, or loading the code into memory
- This allows for dynamic libraries to be kept memory resident for use by many programs at the same time.