Midterm Flashcards
Logical address
Included in the machine language instructions to specify the address of an operand or instruction. Includes a segment selector and an offset.
Linear Address
A single 32-bit integer that can be used to address up to 4GB
Physical Address
Used to address memory cells in memory chips. They correspond to the electrical signals sent along the address pins of the microprocessor to the memory bus. Physical addresses are represented as 32-bit or 36-bit unsigned integers.
MMU
Turns a logical address into a linear address through the segmentation unit and a linear address to a physical address through the paging unit
Segmentation in hardware
Performs address translation in two ways: real mode and protected mode. Real mode only exists for backwards compatibility.
What two parts does a logical address consist of?
A segment identifier, and a segment offset that provides the relative address within the segment
What are segment registers?
There only purpose is to hold segment selectors(identifiers) for easy access.
What are the cs, ss, and ds registers used for?
CS: Code segment, points to segment containing program instructions. Also included a 2-bit field for the current running mode (3 for user mode, 0 for kernel mode)
SS: Stack segment, points to segment containing current running stack
DS: Data segment, points to segment containing global and static data
What is a segment descriptor?
Represents a segment and describes that segment’s characteristics
What are the GDT and LDT?
Places where segment descriptors are stored. Each program can have multiple LDTs (Local descriptor table), and there is only usually one GDT (Global descriptor table).
What are the nonprogrammable segmentation registers?
Every time a segment selector is loaded from memory, the segment descriptor is loaded into the non programmable register. That way, when transforming from logical into linear addresses, the CPU can use that register rather than looking it up in the GDT/LDT.
Why are using BOTH segmentation and paging redundant?
Segmentation can provide a linear address space to each process, while paging can map the same linear address space into different physical address spaces.
Why does linux prefer paging to segmentation?
Memory management is easier when all processes work off of the the same segment register values (that is, when they share the same linear address space). Also, implementations exist that have limited support for segmentation.
What are the four critical segment descriptors?
User code, user data, kernel code, kernel data
Why did linux decide to start the linear address space for all segments at 0?
The value of the offset field in logical addresses perfectly corresponds to linear address, and all programs, user or kernel, can use all logical addresses.