Memory Management
Memory Management
AIM – To understand the concepts of allocating in-coming processes to available memory blocks.
Learning Objectives:
To understand the ability to move process around in memory without it affecting its
execution.
To learn how OS manages memory and processes.
To know how a program be relocated before or during loading of process into memory
To learn how OS allows sharing, while at the same time ensure protection
Overview:
What is memory?
The term memory can be defined as a collection of data in a specific format. It is used to store
instructions and process data. The memory comprises a large array or group of words or bytes, each
with its own location. The primary purpose of a computer system is to execute programs. These
programs, along with the information they access, should be in the main memory during execution.
The CPU fetches instructions from memory according to the value of the program counter.To achieve
a degree of multiprogramming and proper utilization of memory, memory management is important.
In a multiprogramming computer, the Operating System resides in a part of memory, and the rest is
used by multiple processes. The task of subdividing the memory among different processes is called
Memory Management. Memory management is a method in the operating system to manage
operations between main memory and disk during process execution. The main aim of memory
management is to achieve efficient utilization of memory.
Memory Allocation
To gain proper memory utilization, memory allocation must be allocated efficient manner. One of the
simplest methods for allocating memory is to divide memory into several fixed-sized partitions and
each partition contains exactly one process. Thus, the degree of multiprogramming is obtained by
the number of partitions.
Multiple partition allocation: In this method, a process is selected from the input queue and loaded
into the free partition. When the process terminates, the partition becomes available for other
processes.
Fixed partition allocation: In this method, the operating system maintains a table that indicates
which parts of memory are available and which are occupied by processes. Initially, all memory is
available for user processes and is considered one large block of available memory. When the
process arrives and needs memory, we search for a hole that is large enough to store this process. If
the requirement is fulfilled then we allocate memory to process, otherwise keeping the rest available
to satisfy future requests. While allocating a memory sometimes dynamic storage allocation
problems occur, which concerns how to satisfy a request of size n from a list of free holes.
First fit
Best fit
Worst fit
First Fit
The first-fit algorithm searches for the first free partition that is large enough to accommodate the
process. The operating system starts searching from the beginning of the memory and allocates the
first free partition that is large enough to fit the process.
| 10 KB | 20 KB | 15 KB | 25 KB | 30 KB |
Now, a process requests 18 KB of memory. The operating system starts searching from the beginning
and finds the first free partition of 20 KB. It allocates the process to that partition and keeps the
remaining 2 KB as free memory.
Best Fit
The best-fit algorithm searches for the smallest free partition that is large enough to accommodate
the process. The operating system searches the entire memory and selects the free partition that is
closest in size to the process.
| 10 KB | 20 KB | 15 KB | 25 KB | 30 KB |
Now, a process requests 18 KB of memory. The operating system searches for the smallest free
partition that is larger than 18 KB, and it finds the partition of 20 KB. It allocates the process to that
partition and keeps the remaining 2 KB as free memory.
Worst Fit
The worst-fit algorithm searches for the largest free partition and allocates the process to it. This
algorithm is designed to leave the largest possible free partition for future use.
| 10 KB | 20 KB | 15 KB | 25 KB | 30 KB |
Now, a process requests 18 KB of memory. The operating system searches for the largest free
partition, which is 30 KB. It allocates the process to that partition and keeps the remaining 12 KB as
free memory.
PRE TEST
b) cpu
c) user processes
operating system
Memory management technique in which system stores and retrieves data from secondary storage
for use in main memory is called?
a) fragmentation
b) paging
c) mapping
Paging
a) physical address
b) absolute address
c) logical address
logical Address
When memory is divided into several fixed sized partitions, each partition may contain ________
5 MCQS to be added