In the operating system, the following are four common memory management techniques.
Most of the operating systems (for example Windows and Linux) use Segmentation with Paging. A process is divided into segments and individual segments have pages.
In Partition Allocation, when there is more than one partition freely available to accommodate a process’s request, a partition must be selected. To choose a particular partition, a partition allocation method is needed. A partition allocation method is considered better if it avoids internal fragmentation.
When it is time to load a process into the main memory and if there is more than one free block of memory of sufficient size then the OS decides which free block to allocate.
There are different Placement Algorithm:
Is Best-Fit really best?
Although best fit minimizes the wastage space, it consumes a lot of processor time for searching the block which is close to the required size. Also, Best-fit may perform poorer than other algorithms in some cases. For example, see the below exercise.
Exercise: Consider the requests from processes in given order 300K, 25K, 125K, and 50K. Let there be two blocks of memory available of size 150K followed by a block size 350K.
Which of the following partition allocation schemes can satisfy the above requests?
(a) Best fit but not first fit.
(b) First fit but not best fit.
(c) Both First fit & Best fit.
(d) neither first fit nor best fit.
Ans: (b)
Solution: Let us try all options.
Best Fit:
First Fit:
So option (b) is the correct choice.
In operating systems, Memory Management is the function responsible for allocating and managing computer’s main memory. Memory Management function keeps track of the status of each memory location, either allocated or free to ensure effective and efficient use of Primary Memory.
There are two Memory Management Techniques: Contiguous, and Non-Contiguous. In Contiguous Technique, executing process must be loaded entirely in main-memory.
Contiguous Technique can be divided into:
1. Fixed Partitioning: This is the oldest and simplest technique used to put more than one processes in the main memory. In this partitioning, number of partitions (non-overlapping) in RAM are fixed but size of each partition may or may not be same. As it is contiguous allocation, hence no spanning is allowed. Here partition are made before execution or during system configure.
As illustrated in above figure, first process is only consuming 1MB out of 4MB in the main memory.
Hence, Internal Fragmentation in first block is (4 - 1) = 3MB.
Sum of Internal Fragmentation in every block = (4 - 1) + (8 - 7) + (8 - 7) + (16 - 14) = 3 + 1 + 1 + 2 = 7MB.
Suppose process P5 of size 7MB comes. But this process cannot be accommodated inspite of available free space because of contiguous allocation (as spanning is not allowed). Hence, 7MB becomes part of External Fragmentation.
There are some advantages and disadvantages of fixed partitioning.
Advantages of Fixed Partitioning:
Disadvantages of Fixed Partitioning
2. Variable Partitioning
It is a part of Contiguous allocation technique. It is used to alleviate the problem faced by Fixed Partitioning. In contrast with fixed partitioning, partitions are not made before the execution or during system configure. Various features associated with variable Partitioning-
There are some advantages and disadvantages of variable partitioning over fixed partitioning as given below.
Advantages of Variable Partitioning
Disadvantages of Variable Partitioning
Now P5 of size 3 MB cannot be accommodated in spite of required available space because in contiguous no spanning is allowed.
10 videos|99 docs|33 tests
|
1. What are partition allocation methods in memory management? |
2. What are the types of partition allocation methods? |
3. What is internal fragmentation in partition allocation methods? |
4. How does external fragmentation affect partition allocation methods? |
5. Which partition allocation method is the most efficient? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|