Memory Management in Operating Systems | OS Tutorials YASH PAL, June 11, 2026June 11, 2026 The main purpose of a computer operating system is to execute programs. These programs, together with the data they access, must be in main memory during execution. To improve both the CPU utilization and the speed of its response to users, the computer must keep several processes in memory. To achieve this task, we have multiple memory management schemes.Table of Contents Memory Management in OSMemory Management RequirementsRelocationProtectionSharingLogical OrganizationPhysical OrganizationMemory Management in OSThe selection of a memory management scheme for a system depends on many factors, especially the system’s hardware design. In a uniprogramming system, main memory is divided into two parts:One part for the operating system (resident monitor, kernel).The other part for the program currently being executed.In a multiprogramming system, the “user” part of memory must be further subdivided to accommodate multiple processes. The task of subdivision is carried out dynamically by the operating system and is known as memory management. Different techniques of memory management are described in Table 1.TechniqueDescriptionStrengthsWeaknessesFixedPartitioningMain memory is divided into several static partitions at system generation time. A process may be loaded into a partition of equal or greater size.Simple to implement; little operating system overhead.Inefficient use of memory due to internal fragmentation; maximum number of active processes is fixed.DynamicPartitioningPartitions are created dynamically, so that each process is loaded into a partition of the same size as that process.No internal fragmentation; more efficient use of main memory.Inefficient use of processor due to the need for compaction to counter external fragmentation.SimplePagingMain memory is divided into several equal-size frames. Each process is divided into several equal-size pages of the same length as frames. A process is loaded by loading all of its pages into available, not necessarily contiguous, frames.No external fragmentation.A small amount of internal fragmentation.SimpleSegmentationEach process is divided into a number of segments. A process is loaded by loading all of its segments into dynamic partitions that need not be contiguous.No internal fragmentation; improved memory utilization and reduced overhead compared to dynamic partitioning.External fragmentation.Virtual MemoryPagingAs with simple paging, except that it is not necessary to load all of the pages of a process. Nonresident pages that are needed are brought in later automatically.No external fragmentation; higher degree of multiprogramming; large virtual address space.Overhead of complex memory management.VirtualMemorySegmentationAs with simple segmentation, except that it is not necessary to load all of the segments of a process. Nonresident segments that are needed are brought in later automatically.No internal fragmentation, higher degree of multiprogramming; large virtual address space; protection and sharing support.Overhead of complex memory management.Table 1: Memory Management TechniquesMemory Management RequirementsThere are basically five requirements for memory management. These are listed below:RelocationProtectionSharingLogical OrganizationPhysical OrganizationRelocationIn a multiprogramming system, the available main memory is generally shared among a number of processes.The programmer can’t know in advance which other programs will be resident in main memory when his or her program executes.In addition, to swap active processes in and out of main memory to maximize processor utilization by providing a large pool of ready processes to execute.Once a program has been swapped out to disk, it would be quite limiting to declare that when it is next swapped back in, it must be placed in the same main memory as before.Instead, we may need to relocate the process to a different area of memory.Figure 1 depicts the facts that raise some technical concerns related to addressing.Figure 1: Addressing Requirements for a ProcessProtectionEach process should be protected against unwanted interference by other processes, whether accidental or intentional. Thus, programs in other processes should not be able to reference memory locations in a process for reading or writing purposes without permission.Normally, a user process cannot access any portion of the operating system, neither program nor data. Without special arrangement, a program in one process cannot access the data area of another process.SharingAny protection mechanism must have the flexibility to allow several processes to access the same portion of main memory.Logical OrganizationMain memory in a computer system is organized as a linear or one-dimensional address space, consisting of a sequence of bytes or words.Physical OrganizationComputer memory is organized into at least two levels, referred to as main memory and secondary memory.Main memory provides fast access at relatively high cost. In addition, its main memory is volatile, that is, it does not provide permanent storage.Secondary memory is slower and cheaper than main memory and is usually non-volatile.Thus, secondary memory of large capacity can be provided for long-term storage of programs and data, while a smaller main memory holds programs and data currently in use. engineering subjects Operating System Operating System