Monday, March 21, 2011

Memory Management

Objectives Memory Management :
Ø To provide a detailed description of various ways of
     organizing memory hardware.
Ø To discuss various memory-management techniques,
     including paging and segmentation.
Ø To provide a detailed description of the Intel Pentium, which supports both pure segmentation and segmentation with paging.

Concept Memory Management
Ø Program must be brought (from disk) into memory and placed within a process for it to be run.
Ø Main memory and registers are only storage CPU can access directly.
Ø Register access in one CPU clock (or less).
Ø Main memory can take many cycles.
Ø Cache sits between main memory and CPU registers.
Ø Protection of memory required to ensure correct operation.


Virtual Memory Implementation:
virtual memory  is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture's various hardware memory device (such as RAM modules and disk storage drives), allowing a program to be designed as though:
  • ·        There is only one hardware memory device and this "virtual" device acts like a RAM module.
  • ·        The program has, by default, sole access to this virtual RAM module as the basis for a contiguous working memory.
  • ·        When the kernel detects a page fault it will generally adjust the virtual memory range of the program which triggered it, granting it access to the memory requested. This gives the kernel discretionary power over where a particular application's memory is stored, or even whether or not it has actually been allocated yet.


Segmentation

Ø Memory-management scheme that supports user view of memory
Ø A program is a collection of segments. A segment is a logical unit
such as:
  • -         main program,
  • -         procedure,
  • -         function,
  • -         method,
  • -         object,
  • -         local variables, global variables,
  • -         common block,
  • -         stack,
  • -         symbol table, arrays


PAGING
  • Ø  Logical address space of a process can be noncontiguous;  process is allocated physical memory whenever the latter is   available
  • Ø  Divide physical memory into fixed-sized blocks called frames (size is power of 2, between 512 bytes and 8,192 bytes)
  • Ø  Divide logical memory into blocks of same size called pages
  • Ø Keep track of all free frames
  • Ø To run a program of size n pages, need to find n free frames and load program
  • Ø Set up a page table to translate logical to physical addresses
  • Ø Internal fragmentation


Explain Memory Relocations Of Paging System
Paging permits a program to be allocated noncontiguous blocks of memory. We divide programs into pages which are blocks of small, fixed size. We then divide the physical memory into frames which are blocks of size equal to page size. We use a page-table to map program pages to memory frames.
The page size (S) is defined by the hardware. Generally it ranges from 512 words/page to 4096 words/page.

No comments:

Post a Comment