0% found this document useful (0 votes)
78 views6 pages

4.2 Contiguous Memory Partitioning Schemes

The document discusses memory management techniques, specifically focusing on contiguous and non-contiguous memory allocation. Contiguous memory allocation assigns a single block of memory to a process, while non-contiguous allocation allows processes to occupy multiple scattered memory blocks. The document further elaborates on single and multiple partitioning schemes, their advantages, disadvantages, and the issues of fragmentation in memory management.

Uploaded by

pratikagupta695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views6 pages

4.2 Contiguous Memory Partitioning Schemes

The document discusses memory management techniques, specifically focusing on contiguous and non-contiguous memory allocation. Contiguous memory allocation assigns a single block of memory to a process, while non-contiguous allocation allows processes to occupy multiple scattered memory blocks. The document further elaborates on single and multiple partitioning schemes, their advantages, disadvantages, and the issues of fragmentation in memory management.

Uploaded by

pratikagupta695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Contiguous Memory Management: Page 1 of 6

Memory management Techniques:

The Memory management Techniques can be classified into following main categories:

o Contiguous memory management schemes


o Non-Contiguous memory management schemes

Difference between Contiguous and Non-Contiguous Memory Allocation

In the Operating System, there are two techniques for memory allocation and these are as
follows:

• Contiguous Memory Allocation


• Non-Contiguous Memory Allocation

Contiguous Memory Allocation: In Contiguous Memory Allocation whenever any user process
request for the memory then a single section of the contiguous memory block is allocated to that
process according to the requirements of the process. Contiguous memory allocation is achieved
just by dividing the memory into the fixed-sized partition.

In this, all the available memory space remains together at one place and freely
available memory partitions are not distributed here and there across the whole memory
space.
Contiguous Memory Management: Page 2 of 6

Non-Contiguous Memory Allocation: With the help of Non-contiguous memory allocation, a


process is allowed to acquire several memory blocks at different locations in the
memory according to its need. In the non-contiguous memory allocation, the available free
memory space is distributed here and there which means that all the free memory space is not in
one place.

In this technique, memory space acquired by a process is not at one place but it is at different
locations according to the requirements of the process.

Fig a: Contiguous Memory Allocation Fig b: Non-Contiguous Memory Allocation

Now it's time to take a look at the differences between Contiguous and Non-Contiguous Memory
Allocation.

Contiguous Memory Allocation Non-Contiguous Memory Allocation

The non-Contiguous Memory allocation technique divides


The contiguous Memory Allocation technique
the process into several blocks and then places them in
allocates one single contiguous block of
the different address space of the memory that is
memory to the process and memory is allocated
memory is allocated to the process in a non-contiguous
to the process in a continuous fashion.
fashion.

In this Allocation scheme, there is no


While in this scheme, there is overhead in the address
overhead in the address translation while the
translation while the execution of the process.
execution of the process.

In Contiguous Memory Allocation, the In Non-contiguous Memory allocation execution of the


process executes faster because the whole process is slow as the process is in different locations of
process is in a sequential block. the memory.

Contiguous Memory Allocation is easier for the The non-Contiguous Memory Allocation scheme is
Operating System to control. difficult for the Operating System to control.
Contiguous Memory Management: Page 3 of 6

Contiguous Memory Allocation Non-Contiguous Memory Allocation

In this, the memory space is divided into fixed- In this scheme, the process is divided into several blocks
sized partitions and each partition is allocated and then these blocks are placed in different parts of the
only to a single process. memory according to the availability of memory space.

Contiguous memory allocation includes single


Non-Contiguous memory allocation includes Paging and
partition allocation and multi-partition
Segmentation.
allocation.

In this type of memory allocation, generally, a In this type of memory allocation generally, a table has
table is maintained by the operating system that to be maintained for each process that mainly carries
maintains the list of all available and occupied the base addresses of each block that has been
partitions in the memory space. acquired by a process in the memory.

There is wastage of memory in Contiguous There is no wastage of memory in Non-Contiguous


Memory allocation. Memory allocation.

In this type of allocation, swapped-in processes In this type of allocation, swapped-in processes can be
are arranged in the originally allocated space. arranged in any place in the memory.

Contiguous memory management schemes:

In a Contiguous memory management scheme, each program occupies a single contiguous block
of storage locations, i.e., a set of memory locations with consecutive addresses.

Single contiguous memory management schemes:

The Single contiguous memory management scheme is the simplest memory management
scheme used in the earliest generation of computer systems. In this scheme, the main memory
is divided into two contiguous areas or partitions. The operating systems reside permanently in
one partition, generally at the lower memory, and the user process is loaded into the other
partition.

Advantages of Single contiguous memory management schemes:

o Simple to implement.
o Easy to manage and design.
o In a Single contiguous memory management scheme, once a process is loaded, it is given
full processor's time, and no other processor will interrupt it.

Disadvantages of Single contiguous memory management schemes:

o Wastage of memory space due to unused memory as the process is unlikely to use all the
available memory space.
o The CPU remains idle, waiting for the disk to load the binary image into the main memory.
Contiguous Memory Management: Page 4 of 6

o It cannot be executed if the program is too large to fit the entire available main memory
space.
o It does not support multiprogramming, i.e., it cannot handle multiple programs
simultaneously.

Multiple Partitioning:

The single Contiguous memory management scheme is inefficient as it limits computers to


execute only one program at a time resulting in wastage in memory space and CPU time. The
problem of inefficient CPU use can be overcome using multiprogramming that allows more than
one program to run concurrently. To switch between two processes, the operating systems need
to load both processes into the main memory. The operating system needs to divide the available
main memory into multiple parts to load multiple processes into the main memory. Thus, multiple
processes can reside in the main memory simultaneously.

The multiple partitioning schemes can be of two types:

A. Fixed Partitioning
B. Dynamic Partitioning

In most schemes for memory management, we can assume that the OS occupies some fixed
portion of main memory and that the rest of main memory is available for use by multiple
processes.

A. Fixed Partitioning

The main memory is divided into several fixed-sized partitions in a fixed partition memory
management scheme or static partitioning. These partitions can be of the same size or different
sizes. Each partition can hold a single process. The number of partitions determines the degree
of multiprogramming, i.e., the maximum number of processes in memory. These partitions are
made at the time of system generation and remain fixed after that.

The simplest scheme for managing this available memory is to partition it into regions with fixed
boundaries.

Advantages of Fixed Partitioning memory management schemes:

o Simple to implement.
o Easy to manage and design.

Disadvantages of Fixed Partitioning memory management schemes:

o Main memory utilization is extremely inefficient. Any program, no matter how small,
occupies an entire partition. In our example, there may be a program whose length is less
than 2 Mbytes; yet it occupies an 8-Mbyte partition whenever it is swapped in. This
phenomenon, in which there is wasted space internal to a partition due to the fact that the
block of data loaded is smaller than the partition, is referred to as internal fragmentation.
Contiguous Memory Management: Page 5 of 6

(a) Equal-size partitions


(b) Unequal-size partitions

Both the first-fit and best-fit strategies for


memory allocation suffer from external
fragmentation. As processes are loaded
and removed from memory, the free
memory space is broken into little pieces.
External fragmentation exists when there
is enough total memory space to satisfy
a request but the available spaces are
not contiguous: storage is fragmented
into a large number of small holes.

As this example shows, this method


starts out well, but eventually it leads to a
situation in which there are a lot of small
holes in memory. As time goes on,
memory becomes more and more
fragmented, and memory utilization
declines. This phenomenon is referred to
as external fragmentation, indicating
that the memory that is external to all
partitions becomes increasingly
fragmented. This is in contrast to internal fragmentation, referred to earlier.

B. Dynamic Partitioning

Both of these problems can be lessened, though not solved, by using unequal size partitions
(Figure b). In this example, programs as large as 16 Mbytes can be accommodated without
overlays. Partitions smaller than 8 Mbytes allow smaller programs to be accommodated with less
internal fragmentation.

The dynamic partitioning was designed to overcome the problems of a fixed partitioning scheme.
In a dynamic partitioning scheme, each process occupies only as much memory as they require
when loaded for processing. Requested processes are allocated memory until the entire physical
memory is exhausted or the remaining space is insufficient to hold the requesting process. In this
scheme the partitions used are of variable size, and the number of partitions is not defined at the
system generation time.

Advantages: Simple to implement, Easy to manage and design.

Disadvantages:

o This scheme also suffers from internal fragmentation.


o The number of partitions is specified at the time of system segmentation.
Contiguous Memory Management: Page 6 of 6

One technique for overcoming external fragmentation is compaction: From time to time, the OS
shifts the processes so that they are contiguous and so that all of the free memory is together in
one block. For example, in Figure 4h, compaction will result in a block of free memory of length
16M. This may well be sufficient to load in an additional process. The difficulty with compaction
is that it is a time-consuming procedure and wasteful of processor time. Note that compaction
implies the need for a dynamic relocation capability. That is, it must be possible to move a
program from one region to another in main memory without invalidating the memory references
in the program

Figure 4 The Effect of Dynamic Partitioning

You might also like