0% found this document useful (0 votes)
29 views

What Is Memory Management

Memory management is required for processes in an operating system to efficiently utilize memory. It allocates and de-allocates memory for processes and tracks used memory to minimize issues like fragmentation. Memory is divided into logical address spaces assigned to processes and physical address spaces in memory. Paging is a common memory management scheme that uses pages to map virtual to physical addresses, allowing sharing and protection of memory for processes.

Uploaded by

digupathania25
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

What Is Memory Management

Memory management is required for processes in an operating system to efficiently utilize memory. It allocates and de-allocates memory for processes and tracks used memory to minimize issues like fragmentation. Memory is divided into logical address spaces assigned to processes and physical address spaces in memory. Paging is a common memory management scheme that uses pages to map virtual to physical addresses, allowing sharing and protection of memory for processes.

Uploaded by

digupathania25
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

What is Memory Management?

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.

Why Memory Management is Required?


 Allocate and de-allocate memory before and after process execution.
 To keep track of used memory space by processes.
 To minimize fragmentation issues.
 To proper utilization of main memory.
 To maintain data integrity while executing of process.
Now we are discussing the concept of Logical Address Space and Physical Address Space

Logical and Physical Address Space


 Logical Address Space: An address generated by the CPU is known as a “Logical Address”. It is also known as a Virtual address. Logical
address space can be defined as the size of the process. A logical address can be changed.
 Physical Address Space: An address seen by the memory unit (i.e the one loaded into the memory address register of the memory) is
commonly known as a “Physical Address”. A Physical address is also known as a Real address. The set of all physical addresses
corresponding to these logical addresses is known as Physical address space. A physical address is computed by MMU. The run-time mapping
from virtual to physical addresses is done by a hardware device Memory Management Unit(MMU). The physical address always remains
constant.
 Memory allocation is the process of assigning memory segments to processes or data structures in a computer system. Contiguous
memory allocation, fixed and variable partitioning, fragmentation (both internal and external), and compaction are all related concepts in
memory management. Here's an explanation of each:
 Contiguous Memory Allocation: Contiguous memory allocation involves allocating memory segments to processes or data structures in a
consecutive or contiguous manner. In this approach, each process or data structure is assigned a block of memory that occupies a
continuous range of memory addresses.
 Fixed Partitioning: In fixed partitioning, memory is divided into fixed-size partitions or blocks. Each partition is assigned to a process at the
time of allocation. Fixed partitioning requires predefined sizes for each partition, typically determined during system setup or configuration.
 Variable Partitioning: Variable partitioning, also known as dynamic partitioning, allocates memory partitions of varying sizes to processes
based on their memory requirements. When a process requests memory, a suitable partition is allocated from the available free memory
blocks. This allows for more flexible memory allocation.
 Internal Fragmentation: Internal fragmentation occurs in memory allocation when allocated memory blocks contain unused or wasted
memory space. It happens when a memory partition is larger than what a process or data structure actually requires. The unused memory
within a partition is not available for allocation to other processes, resulting in inefficient memory utilization.
 External Fragmentation: External fragmentation occurs when there is free memory space available in the system, but it is scattered or
fragmented into small, non-contiguous blocks. As a result, even though the total amount of free memory might be sufficient to fulfill a
memory request, the scattered nature of free blocks prevents their effective utilization. External fragmentation can make it challenging to
allocate larger memory segments to processes.
 Compaction: Compaction is a technique used to reduce external fragmentation. It involves rearranging the memory by compacting the
allocated memory blocks and freeing up scattered free memory blocks. During compaction, the allocated memory blocks are moved
together, leaving a larger continuous block of free memory. Compaction typically requires the relocation of processes, which can be time-
consuming and may impact system performance.
 By managing memory allocation effectively, operating systems can mitigate internal and external fragmentation and improve memory
utilization, thereby optimizing the overall performance of the system. Different memory management algorithms and techniques are
employed to address these challenges and ensure efficient memory allocation.

Paging is a memory management scheme used by operating systems to efficiently utilize physical memory. Here are the key aspects of paging:

Principle of Operation:

 Paging divides the virtual memory of a process into fixed-size blocks called pages. Similarly, physical memory is divided into frames of the
same size.
 The virtual address space of a process is divided into pages, and the corresponding physical address space is divided into frames.
 When a process references a memory address, the virtual address is translated to a physical address using a page table, which maintains the
mapping between virtual pages and physical frames.
 The page table is stored in the memory and is accessed to perform the address translation.
Page Allocation:

 When a process is created or requires more memory, pages are allocated to it. The allocation can be done in two ways: demand paging or
pre-paging.
 Demand paging allocates pages to a process only when they are needed. Initially, only a small portion of the program is loaded into
memory, and additional pages are loaded as they are accessed.
 Pre-paging, on the other hand, loads additional pages into memory even before they are accessed, based on certain algorithms or
heuristics.

Hardware Support for Paging:

 Paging relies on hardware support provided by the CPU and memory management unit (MMU).
 The MMU performs the translation of virtual addresses to physical addresses using the page table.
 The CPU includes special registers, such as the page table base register and the page table length register, which hold the location and size
of the page table, respectively.
 The CPU also generates page faults if a required page is not present in memory, triggering the operating system to bring it in from disk.

Protection and Sharing:

 Paging facilitates memory protection by assigning access permissions to each page. The page table entry includes protection bits that
control read, write, and execute permissions for a given page.
 Paging also enables memory sharing among multiple processes. Pages can be marked as read-only and shared among multiple processes,
reducing memory consumption and facilitating inter-process communication.

Disadvantages of Paging:

 Internal Fragmentation: Paging can lead to internal fragmentation, where memory pages or frames are not fully utilized, resulting in wasted
memory space. This can happen if a page is not fully occupied by data or if a page is larger than necessary.
 Overhead: Paging introduces additional overhead in terms of memory consumed by the page table and the overhead of address translation
performed by the MMU.
 Thrashing: Thrashing occurs when the system spends a significant amount of time swapping pages between disk and memory due to
excessive page faults. It can severely degrade system performance.

It's important to note that while paging offers advantages such as efficient memory utilization and protection, its implementation and impact can vary
depending on the specific operating system and hardware architecture

You might also like