CST334 - Week 26
- YZ

- Jul 13, 2020
- 2 min read
This week I learned all about memory, particularly the virtualization of memory through the use of address space. Address space is an abstraction of physical memory, giving each program the illusion of large amounts of private memory starting at the address location 0. In reality, the information is stored elsewhere in physical memory. Within memory, there is stack memory/automatic memory and heap memory. The compiler manages the allocation and deallocation of stack memory automatically, while a programmer must handle the allocation and deallocation of heap memory using explicit calls such as malloc() and free(). The MMU is responsible for address translation. The OS will decide where in physical memory a program should be loaded and it uses the base and bounds registers for translation. A physical address can be found by adding the base to the virtual address, and the bounds help ensure that the memory reference is within bounds of the memory space available. To solve the issue of wasting address space with the extra free space between the stack and heap, address space can be divided into segments, each with its own base and bounds registers. These segments can be stored in different places in memory. The OS must manage the free space in memory by keeping a free list that keeps track of which space is available for use. To avoid external fragmentation, small, useless holes in physical memory that can't be used, memory can be compacted by copying data and rearranging the segments. Additionally, programmers implement algorithms to reduce fragmentation, such as the worst-fit method, which leaves over the largest amount of free memory space so that it can likely be used by another process. Lastly, for Lab 3, I manipulated and run multi-process and multi-task programs that included the use of pipes.




Comments