Contigious Memory Allocation
Contigious Memory Allocation
MEMORY
ALLOCATION
Group 2
Shahala, Dilsha, Nivedh, Muhseen, Abhijeet
January 31st 2024
Introduction
2
Single Contiguous Memory
In the scheme of single conti guous memory management, the physical
memory is conceptually divided into two conti guous areas. One of them
is permanently allocated to the resident porti on of the operati ng
system. The remaining memory is allocated to the transient and user
processes, which are loaded and executed one at a ti me, in response to
user commands Memory parti ti oning in single conti guous allocati on is
shown .This form of memory management is commonly used by single
process microcomputer operati ng systems, such as PC-DOS.
3
4 February 12, 2024
5
“
Protecting Operating System Code
1. Protection bit method :
Memory protection can be achieved by
2. Fence Register Method:
assigning a protection bit to each memory
word. Imagine dividing the memory into Involves a dedicated register defining the
two areas by setting protection bits in one boundary between OS and user areas. -
and clearing them in the other. During Detects and denies any attempt by user
system start-up, the operating system's processes to access OS code below the set
locations get protected. User programs run fence. - Modification of fence register must
in the remaining memory, restricted from be a privileged operation restricted
areas with set protection bits. This ensures from user processes.
the operating system and essential utilities
have unrestricted access for their
functions.
7
8
Advantages
In static (fixed) partitioned memory management scheme, the available physical memory
is logically divided into several partitions during system
generation process. These partitions could be of different sizes, but once
decided at the time of system generation, they cannot not be changed. The
number and size of individual partitions are usually determined during the
system generation process, taking into consideration the capacity of the
10
available physical memory,
Out of six partitions, one is
assumed to be occupied by the
resident portion
of the operating system, and
three others by user processes
P₁, Pj and Pk,
as indicated. The remaining two
partitions are free and available
for allocation.
11
Partition Partition Base Partition Size Partition Status
No
0 0K 100 K ALLOCATED
1 100 K 300 K FREE
2 400 K 100 K ALLOCATED
3 500 K 250 K ALLOCATED
4 750 K 150 K ALLOCATED
5 900 K 100 K FREE
As indicated each partition is described by its starting address (base),size and status. When
static partitioning is used, only the status field of each entry varies in the course of system
operation, depending on
whether the corresponding partition is allocated or not at any given instant. All other fields are
static and contain the values defined at partition definition time.
In the sample PDT given above, partitions 1 and 5 are assumed to be available for allocation
and partitions 0, 2, 3, and 4 are occupied by some processes.
When creating or activating a non-resident process,
the operating system checks the Process Descriptor
Table (PDT) to find a free memory partition. If
successful, the PDT entry is marked as
ALLOCATED, and the process image is loaded into
the partition. The PCB records the assigned partition.
Upon process termination or swapping, the PCB
information is used to find the related partition and
update its status to FREE in the PDT.
When allocating a free partition to a process, the operating
system can use either the first-fit or best-fit strategy. In the
first-fit strategy, the system allocates the first available
partition that is large enough for the process. In the best-fit
strategy, the smallest free partition
meeting the process requirements is allocated. The choice
between these strategies depends on factors such as
execution speed and memory utilization.
When allocating a free partition to a process, the operating
system can use either the first-fit or best-fit strategy. In the
first-fit strategy, the system allocates the first available
partition that is large enough for the process. In the best-fit
strategy, the smallest free partition
meeting the process requirements is allocated. The choice
between these strategies depends on factors such as
execution speed and memory utilization.
Processes waiting to be loaded in the
memory are held in queue by the
operating system. There are two
methods of maintaining this queue
multiple queue and single queue. In
multiple queue, there is one separate
queue for each When a process wants to occupy
partition, each corresponding to memory, it is added to a proper
queue depending upon the size of
different size of the partition.
the process. An advantage of this
scheme is that a very small process
is not loaded in a very large partition.
In the single queue method, only one
queue is maintained for all the ready
processes.
The memory manager may not be able to satisfy requests to
allocate memory partitions under certain situations. Some of them
are:
• No partition is large enough to accommodate the incoming
process.
• All partitions are allocated.
• Free but unsuitable partitions are available.
The job cannot be run if it is too large to fit into any of the system
partitions.
DYNAMIC PARTITIONED MEMORY
MANAGEMENT
Dynamic Partitioning is a memory
management technique used in
computing systems to allocate and Dynamic partitioning is a
deallocate memory resources as computer memory
needed. Unlike static partitioning, management technique that
dynamic partitioning allows for allows the system to allocate
and deallocate memory
the creation of new memory
resources as needed, creating
partitions or the resizing of
new partitions or resizing
existing ones at runtime. existing ones at runtime, in
order to optimize memory
Dynamic partitioning allows for efficient use of memory
resources by allocating memory only when needed and
utilization and improve
deallocating it when it is no longer needed. This helps system performance.
to optimize system performance and improve memory
utilization.
Explanation of Dynamic Partitioning Process