CST 334 Week 3
The first topic covered in this week's material was address spaces. An address space is the running program's view of the system memory. It is the operating system’s responsibility to provide virtual memory to the running program, in an efficient and safe manner. This virtual memory contains code, heap memory, and stack memory. Stack memory consists of local variables and function calls and memory allocations and deallocations are done implicitly. Heap memory on the other hand must be allocated and deallocated explicitly by the programmer. The memory API provides functions such as malloc() and free() to do this. The programming assignment this week provided us an in depth look into the logic of these functions, and the potential errors that can occur if they are improperly used. To understand how virtual addresses work within the scope of limited direct execution, we also learned about address translation. This is the process of converting virtual addresses to physical addresses, which is the physical location of the data. Two important hardware components to address translation are the base and bounds registers or MMU. The MMU is responsible for adding the base value and value of the virtual address and verifying that the converted address is valid. We also covered issues that can occur when dealing with memory relocation such as sparse address spaces.An approach to this problem involves dealing with memory addresses in segments. In addition to segmentation, we also learned about free space management. External fragmentation occurs when free memory becomes divided into small, inconsistent pieces. A strategy to manage free memory involves creating a free list, which is a linked list of nodes containing data of the free spaces. There are also several strategies for managing the free list but our lab this week focused on the first fit method. The first fit method traverses the linked link from the beginning and selects the first node that matches the requested memory size.
Comments
Post a Comment