memory allocation (4)

17

Upload: rockymani

Post on 22-May-2015

1.974 views

Category:

Technology


0 download

DESCRIPTION

memory allocation,preemitive allocation,non-preemitive allocation,first fit,best fit,

TRANSCRIPT

Page 1: Memory allocation (4)
Page 2: Memory allocation (4)
Page 3: Memory allocation (4)

Memory is the processes by which information is encoded, stored and retrieved. Encoding allow information that is from the outside world to reach our senses in the forms of chemical and physical stimuli.

Page 4: Memory allocation (4)

An alloation is something that you set aside for use .for instance if you want to set aside a certain amount of hard drive space for an application,you can allocate how much in the settings.

Page 5: Memory allocation (4)

The placement of blocks of information in a memory system is called memory allocation.

To allocate memory it is necessary to keep in information of available memory in the system.If memory management system finds sufficient free memory,it allocates only as much memory as needed ,keeping the rest available to satisfy future request .

If sufficient memory is not available, swapping of blocks is done.

Page 6: Memory allocation (4)

In static memory allocation, size of the memory may be required for the calculation that must be define before loading and executing the program.

Page 7: Memory allocation (4)

Two methods are used for dynamic memory allocation:

1-Nonpreemptive allocation 2-preemptive allocation

Page 8: Memory allocation (4)

Consider M1 as a main memory and M2 as a secondry memory and a block K of n words is to be transferred from M2 to M1.for such memory allocation it is necessary to find or create an available reason of n or more words to accommodate K.This process is known as nonpreemptive allocation.

Page 9: Memory allocation (4)

In this algorithm, searching is started either at the beginning of the memory or where the previous first fit search ended.

Page 10: Memory allocation (4)

In this algorithm, all free memory blocks are searched and smallest free memory block which is large enough to accommodate desired block K is used to allocate K.

Page 11: Memory allocation (4)
Page 12: Memory allocation (4)

Nonpreemptive allocation can’t make efficient use of memory in all situation. Due scattered memory blocks larger free memory blocks may not be available. Much more efficient us of the available memory space is possible if the occupied space can be re allocated to make room for incoming blocks by a method called as compaction.

Page 13: Memory allocation (4)

Fixed memory Stack memory Heap memory

Page 14: Memory allocation (4)

Executable code Global variables Constant structures that don’t fit inside a

machine instruction. (constant arrays, strings, floating points, long integers etc.)

Static variables. Subroutine local variable in non-recursive

languages (e.g. early FORTRAN).

Page 15: Memory allocation (4)

Stores information in such a manner that the item stored last is the first item retrieved.

In digital computer, it is essentially a memory unit with an address register that can count only after an initial value is loaded into it.

Two operations of a stack are 1. Insertion 2. Deletion

Page 16: Memory allocation (4)

Structures whose size varies dynamically (e.g. variable length arrays or strings).

Structures that are allocated dynamically (e.g. records in a linked list).

Structures created by a function call that must survive after the call returns.

Issues: Allocation and free space management Deallocation / garbage collection

Page 17: Memory allocation (4)