TimeLinux1

Sunday, May 22, 2011

OS Concepts - Memory Management - 3

... continued from previous discussion ...

-virtual memory:
-contiguous memory allocation, paging, segmenting all have a common goal - multiprogramming.
-all of the above use swapping of processes in and out of memory to achieve the goal of multiprogramming.
-however, the shortcoming is that they all swap the 'entire' process between mem and disk and back.
-this is where another concept of 'virtual memory' or 'vm' comes in.
-the central idea behind virtual memory is that an entire process need not be swapped in and out of memory.
-instead a process can be divided up into smaller chunks and those smaller chunks can be swapped.
-in other words, virtual memory allows execution of processes that are not completely im memory.
-infact, vm allows existence of programs much larger than physical memory.
-to achieve this the os considers physical memory plus a part of storage as one logical chunk of memory.
-this logical chunk of mem+disk is called virtual memory.
-vm also allows sharing of memory between processes.
-virtual memory is divided up into uniform sized frames.
-the frames are mapped to the logical pages which are what the cpu operates on.
-the logical pages to physical frames mapping is stored in the page table.
-the page table is the software construct that exists in the memory mgmt unit (mmu) that is a hardware component.
-remember, the structure of a process address space is comprised of:
    . text         -program file
    . data         -global vars, constants
    . heap        -dynamic memory location
    . stack        -temp area for functions, params, vars etc
    . empty space    -between heap and stack for growth of either
-in the above, the empty space between the heap and stack is made up of virtual memory.
-so as needed, page-frames from this empty-space are swapped in out.
-the implementation of vm is not without its pitfalls.
-if implemented incorrectly, it can degrade system performance.
-usually this happens in the case of page thrashing.
-thrashing is the condition in which the system is spending more time swapping and less time executing.
-this happens when the scheduler is overwhelmed with the page-frame swapping requests of running processes.

---xxx--

No comments:

Post a Comment