Simulator
Explore how a segmentation-based memory management system translates virtual addresses into physical addresses. Learn to identify valid addresses and segmentation violations through hands-on use of a segmentation simulator. Understand segment growth directions, base and limit registers, and test different memory configurations with customizable parameters.
We'll cover the following...
This program allows you to see how address translations are performed in a system with segmentation. The segmentation that this system uses is pretty simple: an address space has just two segments; further, the top bit of the virtual address generated by the process determines which segment the address is in: 0 for segment 0 (where, say, code and the heap would reside) and 1 for segment 1 (where the stack lives). Segment 0 grows in a positive direction (towards higher addresses), whereas segment 1 grows in the negative direction.
Visually, the address space looks like this:
--------------- virtual address 0
| seg0 |
| |
| |
|-------------|
| |
| |
| |
| |
|(unallocated)|
| |
| |
| |
|-------------|
| |
| seg1 |
|-------------| virtual address max (size of address space)
With segmentation, as you might recall, there is a base/limit pair of registers per segment. Thus, in this problem, there are two base/limit pairs. The segment-0 base tells which physical address the top of segment 0 has been placed in physical memory and the limit tells how big the segment is; the segment-1 base tells where the bottom of segment 1 has been placed in physical memory and the corresponding limit also tells us how big the segment is (or how far it grows in the negative direction).
As before, there are two steps to running the program to ...