CST334.3 Module Three

 

CST334.3 Module Three

What I learned this week:
The readings this week in OSTEP in Ch 13-17 dealt with memory virtualization. 

In Chapter 13 we learned about the Address Space and how its an abstraction of physical memory and is comprised of several components including the: code, heap, stack and free space. The code contains the instruction set of a program. The heap contains memory allocated data, and grows dynamically. The Stack holds variables, arguments to routines and return values, it also grows dynamically as well. Finally, the free space which is between the heap and stack, which also grows/shrinks dynamically in accordance with the growth/reduction of the heap and/or stack. A primary goal of virtualizing memory is to provide isolation/protection from other running processes.

In Chapter 14 we learned about the different types of memory, memory allocation, and the freeing of heap memory. Considering there being two types of memory, there is stack memory, where allocations and deallococations are managed by the compiler for you. There is also heap memory, where all allocations and deallocatiions are explicitly handled by the user/ or writer of code. Considering the malloc() call, it takes size of data in bytes and requests space for an the specified type on the heap. Also worth noting, any instantiation of a char array must be the length + 1, since it is null-terminated.

In Chapter 15 we covered the mechanisms behind address translation, and how the OS and hardware work together to create the illusion of a virtual address space, where dynamic relocation takes place. dynamic relocation is built off of having a base and a bound where the physical address = virtual address + base.

In Chapter 16 we expanded on the separate segments within our address space, and learned about how the idea of having base and bound per address space, also include base and bound pairings for each segment, namely for program Code, Heap and Stack, this enables for code sharing of the stack.

In Chapter 17 we dealt with Free Memory Managements and a few varying strategies, namely Best Fit, First Fit, Worst Fit and Next Fit. Although all strategies come with strengths or benefit to the overall system, they all have tradeoffs so it's dependent on what your looking for within the system, as well as the trends in memory usage for the program.

In Working in the program assignment PA3, we were tasked with building functions in which we imitate memory allocation, and freeing of memory. It incorporated a node list where each nodes properties contain a size, a pointer to the node ahead, and behind, and an is free property which indicates whether the pointer associated with the node is free or not. using this node list. structure we dealt with coalescing free space and also splitting nodes ( in the case that the requested size is smaller than the size associated to the node of choice). 


Comments

Popular Posts