0% found this document useful (0 votes)
223 views

Contiguous Memory Allocation

Contiguous memory allocation involves assigning contiguous blocks of physical memory to processes. It has two main techniques - fixed partitioning and dynamic partitioning. Fixed partitioning assigns each process a fixed-size block of memory, limiting multiprogramming. Dynamic partitioning assigns variable sized blocks based on process needs, avoiding fragmentation but being more complex to implement. Contiguous allocation can result in internal fragmentation and wasted memory, while non-contiguous allocation avoids this by assigning separate memory locations but is slower.

Uploaded by

Altab Additional
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
223 views

Contiguous Memory Allocation

Contiguous memory allocation involves assigning contiguous blocks of physical memory to processes. It has two main techniques - fixed partitioning and dynamic partitioning. Fixed partitioning assigns each process a fixed-size block of memory, limiting multiprogramming. Dynamic partitioning assigns variable sized blocks based on process needs, avoiding fragmentation but being more complex to implement. Contiguous allocation can result in internal fragmentation and wasted memory, while non-contiguous allocation avoids this by assigning separate memory locations but is slower.

Uploaded by

Altab Additional
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Contiguous memory allocation:-

1. In operating systems is a technique where every logical block of a file is assigned a


contiguous physical block on the hard drive.
2. Contiguous memory allocation enables the tasks to be finished in a single memory
region.
3. A software or process requires memory space in order to be run.
4. Allocate contiguous blocks of memory to each process. Therefore, we allot a
continuous segment from the entirely empty area to the process based on its size
whenever a process requests to reach the main memory.

Techniques
This is done by creating fixed-sized memory segments and assigning a single process to each partition.
Therefore, the amount of multiprogramming will be limited by the number of memory-based fixed partitions.

o Fix-size Partitioning Method

Each process in this method of contiguous memory allocation is given a fixed size continuous block
in the main memory. This means that the entire
➢ Three processes in the
memory will be partitioned into continuous blocks of
input queue in the figure
fixed size, and each time a process enters the above require memory
system, it will be given one of the available blocks space allocation. The .
Because each process receives a block of memory has fixed-sized
memory space that is the same size, chunks because we are
regardless of the size of the process. Static using the fixed size
partition technique. In
partitioning is another name for this approach.
addition to the 4MB
process, the first process,
which is 3MB in size, is
given a 5MB block. The
second process, which is
1MB in size, is also given
a 5MB block. So, it
doesn't matter how big
the process is. The same
fixed-size memory block
is assigned to each.

Advantages

A fixed-size partition system has the following benefits:


o This strategy is easy to employ because each block is the same size. Now all that is left to
do is allocate processes to the fixed memory blocks that have been divided up.
o It is simple to keep track of how many memory blocks are still available, which determines
how many further processes can be allocated memory.
o This can be used in a sys. that requires multipro`. since numerous processes can be
maintained in memory at once.

Disadvantages

o We won't be able to allocate space to a process whose size exceeds the block since the size
of the blocks is fixed.
o The amount of multiprogramming is determined by block size, and only as many processes
can run simultaneously in memory as there are available blocks.
o We must assign the process to this block if the block's size is more than that of the process;
nevertheless, this will leave a lot of free space in the block. This open area might have been
used to facilitate another procedure.

o Flexible Partitioning
Method

This memory allocation


technique assigns variable-
sized blocks to processes based
on their needs, with no fixed
blocks or partitions. RAM is
Dynamic partitioning method :- allocated to new processes
when space is available.
Dynamic partitioning is a method where processes are given
only the necessary amount of RAM for them, with flexible
block sizes determined by new processes starting.

Advantage:-
Processes are given blocks of space
according to their needs, avoiding internal
fragmentation and RAM waste.
The number and size of processes can vary
depending on the situation, and even large
processes can be given space.
Dis-advantage:-

o This method is dynamic, hence it is challenging to implement a variable-size partition scheme.


o It is challenging to maintain record of processes and available memory space.

Difference between Contiguous and Non-contiguous Memory Allocation :


S.NO. Contiguous Memory Allocation Non-Contiguous Memory Allocation

Contiguous memory allocation allocates


Non-Contiguous memory allocation allocates
1. consecutive blocks of memory to a
separate blocks of memory to a file/process.
file/process.

2. Faster in Execution. Slower in Execution.

3. It is easier for the OS to control. It is difficult for the OS to control.

Overhead is minimum as not much address


More Overheads are there as there are more
4. translations are there while executing a
address translations.
process.

Both Internal fragmentation and external


Only External fragmentation occurs in Non-
5. fragmentation occurs in Contiguous
Contiguous memory allocation method.
memory allocation method.

It includes single partition allocation and


6. It includes paging and segmentation.
multi-partition allocation.

7. Wastage of memory is there. No memory wastage is there.

In contiguous memory allocation, swapped- In non-contiguous memory allocation,


8. in processes are arranged in the originally swapped-in processes can be arranged in any
allocated space. place in the memory.

It is of five types:
It is of two types: 1. Paging
9. 2. Multilevel Paging
1. Fixed(or static) partitioning
3. Inverted Paging
2. Dynamic partitioning
4. Segmentation
5. Segmented Paging

It could be visualized and implemented


10. It could be implemented using Linked Lists.
using Arrays.

Degree of multiprogramming is fixed as


11. Degree of multiprogramming is not fixed
fixed partitions
Non-contiguous memory allocation in Hindi
Non-contiguous memory allocation एक विवि है विसमें िब एक प्रोसेस secondary
memory से main memory में आता है तो िह pieces में विभावित होता है और main memory
में स्टोर हो िाता है .

दू सरे शब्ोों में कहें तो, “Non-contiguous मैमोरी एलोकेशन एक method है विसमें एक process
को अलग-अलग memory location में मौिूद memory space आिोंवित (allocate) वकये िाते हैं .”

यह मैमोरी एलोकेशन internal और external fragmentation के वलए solution प्रदान करता है .


और यह memory wastage को कम करता है .

linked list इस मैमोरी एलोकेशन का एक उदाहरण है क्ोोंवक हम इसमें last node को direct
access नहीों कर सकते.
advantages (इसके फायदे ) –
• इसमें external fragmentation नहीों होता है .
• यह memory की बचत करता है .
disadvantages (इसके नुकसान) –
• इसमें process को execute होने में ज्यादा
समय लगता है . क्ोोंवक process िु कडोों में
अलग-अलग memory locations पर स्थित
होती है .
• non-contiguous memory को control
करना difficult होता है
Fundamental approaches :

• Paging
1. Each process consists of fixed-size components called pages.
2. The size of a page is defined by the hardware of a computer, and
demarcation of pages is implicit in it.
3. The memory can accommodate an integral number of pages.
4. It is partitioned into memory areas that have the same size as a page, and
each of these memory areas is considered separately for allocation to a
page.
5. This way, any free memory area is exactly the same size as a page, so
external fragmentation does not arise in the system. Internal
fragmentation can arise because the last page of a process is allocated a
page-size memory area even if it is smaller than a page in size.
• Segmentation:-
1. a programmer identifies components called segments in a
process.
2. A segment is a logical entity in a program, e.g., a set of
functions, data structures, or objects.
3. Segmentation facilitates sharing of code, data, and program
modules processes.
4. segments have different sizes, so the kernel has to use
memory reuse techniques such as first-fit or best-fit
allocation. Consequently, external fragmentation can arise.

You might also like