Week 27
Write a 1 - 2 paragraph journal post, of at least 250 words, on what you learned this week in CST 334.
This week in CST334, I deepened my understanding of memory virtualization, focusing on segmentation as a key mechanism to optimize memory usage. Segmentation divides a process’s address space into logical segments (code, heap, stack), each with its own base and bounds registers. Unlike the simpler base-and-bounds approach, which allocates the entire address space contiguously, segmentation allows the OS to allocate only the physically used portions of memory. This significantly reduces internal fragmentation while enabling sparse address spaces, where large virtual memory regions don’t require physical memory unless actively used.
The hardware translation process became clearer. Virtual addresses are split into a segment selector (top bits) and an offset (remaining bits). The hardware combines the segment’s base register with the offset to compute the physical address, while simultaneously checking the offset against the bounds register to prevent illegal accesses. This ensures both efficient translation and memory protection.
However, segmentation introduces challenges like external fragmentation, where free memory becomes scattered into small, non-contiguous blocks over time. To manage this, the OS employs strategies like best-fit/first-fit allocation algorithms or costly compaction. Despite these trade-offs, segmentation’s benefits stood out. Code sharing, Read-only segments, like libraries, can be safely shared across processes, reducing memory overhead. And fine-grained protection, hardware-enforced permissions (read/write/execute) per segment, enhances security.
This week highlighted how OS design balances hardware support (segment registers, address translation circuits) with software policies (allocation algorithms, growth management) to virtualize memory effectively. Ensuring performance, security, and flexibility. Which will be key themes for next week, which addresses segmentation's fragmentation limitations.
Comments
Post a Comment