CST 334 Week 3 Journal Entry

 Intro to Memory Virtualization

Memory virtualization provides the illusion that each process has a large private address space for a program to run. Virtualizing memory is done by building large address spaces for multiple running programs on a single physical memory. Each space has a virtual address that contains the program's instructions and data, as well as a heap, a stack, and free space. The OS takes the virtual address reference and turns it into a physical address for the program to run on. The OS does this with 3 goals in mind: 

  1. Transparency: Each process is not aware that memory is shared.
  2. Efficiency: minimize fragmentation and not waste memory resources
  3. Protection: Onc process cannot corrupt another (isolation)
During the process, memory can be allocated on the heap or stack. Memory is allocated on the stack automatically for variables. Memory on the heap can be allocated by using the malloc() and freed using free(). It is important that once memory is allocated on the heap, it is freed so that memory may not run out. When dealing with memory, it is important to be aware of common errors such as the following: 
  1. Forgetting to allocate memory
  2. Not allocating enough memory
  3. Forgetting to initialize allocated memory
  4. Forgetting to free memory
  5. Freeing memory before you are done with it
  6. Calling free incorrectly 

Comments

Popular posts from this blog

CST 300 - Week 8

CST 300 - Week 5

CST 300 - Week 4