Search This Blog

Thursday 13 October 2011

~ MEMORY MANAGEMENT~


Relocation


In a multiprogramming system, the available main memory is
generally shared among a number of processes. Typically it is not possible
for programmer to know in advance which are the programs that will
reside in the memory during the execution time of a program. In addition
we would like to be able to swap active processes in and out of main
memory to maximize processors usage by providing a large pool of ready
processes to execute.
Each process should be protected against unwanted interference by
other processes, whether accidental or intentional. Thus, programs in
other processes should not be able to reference memory locations in a
process, for reading and writing purposes without permission
Virtual memory can also work in a multiprogramming system. For example
eight 1M programs can each be allocated a 256K partition in a 2M memory,
which each program operating as though it had its own, private 256K machine.
In fact virtual memory multiprogramming fit together very well. While a
program is waiting for part of itself to be swapped in, it is waiting for I/O and
cannot run so the CPU can be given to another process.
The main problem of contagious allocation is external
fragmentation. This is overcome in the present scheme. Here a process is
allocated the physical memory where ever it is available, and this scheme
is call as paging scheme.
In the basic method physical memory is broken into fix size block
call frame. The logical memory also broken into block of the same size
called pages.

Every address generate by the CPU is divided into parts: a page
number (P) and a page offset (d). The page number p is use as an index
into a page table. The page table contains the base address of each page
lying in physical memory. The base address read from page table is
combining with page offset (d) to generate the physical memory address.
Before we consider ways of dealing with the shortcomings of partitioning,
we must clear up one loose end, which relates to the placement of processes in
memory. When the fix partition scheme is used, we can expect that a process
will always be a sign to the same partition. That is, the partition that is selected
when a new process is loaded will always be used to swapped the process back
into memory after it has been swapped up. When the process is first loaded all
relative memory references in the code are replaced by absolute main memory
addresess determine by the base address of the loaded process.
Now, consider that a process in memory include instructions plus data.
The instructions will contain memory references of the following two types;

some arithmetics and logical instructions.
Addresses of data items, used in load and store instructions and

instructions.Addresses of instructions, used for branching and called

No comments:

Post a Comment