Skip to content
Related Articles

Related Articles

Best Ways for Operating System Memory Management
  • Last Updated : 15 Feb, 2021
GeeksforGeeks - Summer Carnival Banner

Prerequisite – Partition Allocation Methods

Contiguous Memory Allocation :
Probably the least difficult technique for the memory portion is to isolate memory into a few fixed partitions. Each partition contains precisely one process. The level of multi-programming relies upon the number of partitions. In the different partition technique, when a partition is free, the process is chosen from the info line and is stacked in to free partition of memory. At the point when a process ends, the memory partition opens up for another process. Batch OS utilizes the fixed size partition conspire.

The OS keeps a table demonstrating which a piece of the memory is free and is involved. At the point when the process enters the framework, it will be stacked into the info line. The OS monitors the memory prerequisite of each process and the measure of memory accessible and figures out which process to designate the memory too. At the point when a process demands, the OS looks for the huge hole for this process, the hole is a huge square of free memory accessible. If the hole is too huge, it is part into two. One section is dispensed to the mentioning process and the other is gotten back to the arrangement of holes. The arrangement of holes is looked at to figure out which hole is ideal to dispense. There are three methodologies to choose a free hole:

First Bit
Allocates the primary hole that is adequately large. This algorithm examines memory from the starting and chooses the most readily accessible square that is adequately huge to hold the process.

Best Bit
It picks the hole i.e., nearest in size to the solicitation. It allocates the littlest hole i.e., sufficiently large to hold the process.



Worst Fit
It picks the hole i.e., nearest in size to the solicitation. It allocates the littlest hole i.e., sufficiently large to hold the process.

Operating Systems :
First, fit and best fit are the most mainstream algorithms for dynamic memory designation. The first fit is by and large quicker. The best fit looks for the whole rundown to locate the littlest hole i.e., adequately huge. The worst fit decreases the pace of creation of the littlest holes. Every one of these algorithms experiences the ill effects of fragmentation.

Memory Protection :
Memory protection infers protecting the OS from the user process and protecting the process from one another. Memory protection is given by utilizing a re-location register, with a breaking point register. The re-location register contains the values of the littlest actual address and the cutoff points register contains a scope of logical addresses.

(Re-location = 100040 and limit = 74600). The logical address should be not exactly the breaking point register; the MMU maps the logical address dynamically by adding the incentive in the relocation register. At the point when the CPU scheduler chooses a process for execution, the dispatcher stacks the re-location and cutoff register with correct values as a piece of the setting switch. Since each address created by the CPU is checked against these registers we can secure the OS and other users’ programs and data from being altered.

Fragmentation :
Memory fragmentation can be of two sorts – Internal Fragmentation and External Fragmentation. In Internal Fragmentation, there is squandered space inside a segment because the square of data stacked is more modest than the partition. Example – If there is a square of 50kb and if the process requests 40kb and on the off chance that the square is allotted to the process, at that point there will be 10kb of memory left.

Outer Fragmentation exists when there is sufficient memory space exists to fulfill the request, however, it is not bordering i.e., stockpiling is divided into an enormous number of little holes. Outer Fragmentation might be either minor or a significant issue. One answer for beating outside fragmentation is compaction. The objective is to move all the free memory together to frame a huge square. Compaction is beyond the realm of imagination consistently. On the off chance that the relocation is static and is done at load time, at that point compaction is beyond the realm of imagination. Another conceivable answer for the outer fragmentation issue is to allow the logical address space of a process to be non-bordering, in this way permitting the process to be dispensed actual memory at whatever point the last is accessible.

Segmentation :
Most users do not consider memory a straight array of bytes rather the users considers memory a 55 an assortment of variable-sized segments that are devoted to a specific utilize. Example – code, data, stack, pile, and so on. A logical address is an assortment of segments. The address determines both the segment name and the offset inside the segments. The users indicate address by utilizing two amounts: a segment name and an offset. For effortlessness, the segments are numbered and referred to by a segment number. So the logical address comprises <segment number, offset>.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :