memory management in os and different type of memory management technique

in this post, we are going to study about memory management in os in detail, we will study the Different type of memory management technique , fragmentation technique and also study the paging and segmentation concept.

memory management in os

memory management in os is responsible to handle primary memory and swaps the process between main memory and disk.The memory manager keeps track of the status of each memory location, either allocated or free. and how much they are allocated, it also tracks when memory is freed or unallocated and updates the status.

 

Different type of memory management  technique

"memory

 

Single memory allocation

single memory allocation is the simplest memory management technique.An example of a single memory is MS-DOS. An embedded system running a single application might also use this technique.

Partitioned allocation

Partitioned allocation divides primary memory into different, usually contiguous areas of memory.Partitions may be either static or boot time or dynamic.

Paged memory management

Memory is divided into fixed sized units called page frames, used in virtual memory environment.

Segmented memory management:

Memory is divided into different segments. In this memory management, allocated memory doesn’t have to be contiguous.

Different type of memory management  technique

Dynamic Linking vs Dynamic Loading

Dynamic linking

 

Linking is a process of collecting and combining various modules of code and data into a executable file that can be loaded into memory and executed.when it combines the libraries at load time, the linking is called static linking and when linking is done at the time of execution, it is called dynamic linking. in static linking, libraries linked at compile time, so program code size becomes bigger whereas in dynamic linking libraries linked at execution time so program size remains smaller.

Dynamic Loading

in dynamic loading, a routine of a program is not loaded until it is called by the program. All routines are kept on disk in a re-locatable table load format. The main program is loaded into memory and is executed.other routine methods or modules are loaded on request. Dynamic loading makes better memory space utilization and unused routine are never loaded.

Fragmentation

Fragmentation occurs in a dynamic memory allocation system, As the process is loaded and removed from main memory the free space is broken into little pieces and many of the free blocks are too small to satisfy any request and memory blocks remain unused, this problem is known as fragmentation.

Type of fragmentation

  1. External fragmentation-External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used.Total memory space exists to satisfy a request, but it is not contiguous.External fragmentation is reduced by compaction or suffle memory contents.
  2. Internal fragmentation- memory block assigned to process is bigger, some partition of memory is left unused as it can’t be used by another process.

paging

paging is a solution to fragmentation.

it is a memory management mechanism that allows the physical address space of a process to be non-contagious. Here physical memory is divided into blocks of equal size called Pages. The pages belonging to a certain process are loaded into available memory frames.

Segmentation

Segmentation is another memory management scheme that breaks memory into logical pieces where each piece represents a group of related information.

Both paging and segmentation have their advantages and disadvantages. So Each segment  is divided into pages and each segment is maintained in a page table. So the logical address is divided into 3 parts listed below:-

  • Segment numbers
  • Page number
  • the displacement or offset number

 

will discuss paging and segmentation in detail in next article –

paging and segmentation in the operating system

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *