Memory Management: 2024 Overview

Written by Coursera Staff • Updated on

Discover memory management in computing, including why it’s important for computers and the various memory management types and techniques.

[Featured Image] A computer programmer is using memory management techniques to optimize random access memory (RAM) on a laptop computer.

Memory management is how a computer allocates the main memory for an operating system (OS), applications, and any other operational processes. Computer memory is not the same as computer storage. Memory stores data temporarily, but computer storage, such as hard drives and solid state drives (SSDs), is where the information is permanently stored.

Continue reading to discover more about memory management, including how it works, memory management techniques, and jobs where you will use memory management. 

Read more: Information Technology (IT) Terms: A to Z Glossary

What is memory management?

Memory management makes computer processes more efficient by allocating memory to processes that need more and releasing memory from applications or programs that may no longer use it. This allocation allows the central processing unit (CPU) to optimize data sending and instruct computer processes. 

Read more: What Is Python Memory Management?

Why is memory important for computers? 

Memory management is essential for increasing your computer's performance and efficiency, as many different applications vie for the computer’s memory. The main memory has space limits, so efficient management is necessary for a computer to function correctly. Memory management keeps a tally of memory location statuses, sharing this information with the processor while keeping a record regarding the memory allocation status.

Where does memory management operate in a computer?

Memory management communicates between three aspects of a computer, allowing for the allocation and efficient use of memory. These three levels are:

Take a closer look at how each level operates in its memory management area. 

Memory management hardware

Several physical computer components play a role in memory management, including the CPU, random access memory (RAM), motherboard, and hard drive. The following describes how each piece of hardware contributes:

  • CPU: The central processing unit is where your computer receives instructions and sends commands to the rest of the computer to complete the task correctly.

  • RAM: Random access memory, or RAM, is the storage location for current data that the computer is actively using. You can think of RAM as the system's short-term memory.

  • Motherboard: The motherboard enables communication throughout your computer and its various components, allowing information to flow between hardware such as the RAM and CPU.

  • Hard drive: While RAM serves as the short-term memory, the hard drive is the computer's long-term memory, where you can store and retrieve information.

Operating systems

Memory management within the OS occurs by allocating and reallocating memory blocks for CPU processes. An operating system is software that runs computer processes, memory management, and applications by communicating with computing components. The OS tracks the allocation of each process and moves processes between storage drives and memory. 

The OS controls which processes get priority in your computer's main memory and which are sent to alternate storage areas using a process called swapping. Deallocated processes reallocate when more memory is available or that process takes priority. 

Another function of the operating system in managing memory is using virtual memory (VM) when the CPU requests more memory than is available. To do this, virtual memory transfers unused data from RAM to a type of storage device—a hard drive or SSD—freeing up the RAM to undertake other responsibilities. Regarding multitasking, virtual memory is an essential feature of the computer and strengthens the system's performance. One downside is that using virtual memory can lead to slowdowns in processing. 

Read more: What Is an Operating System

Applications

Once in use, applications manage their own memory to ensure they allocate the proper memory for their objects and data structures. Applications use two features, allocation and recycling, to distribute memory and recycle its use. 

  • Allocation: A process in an application that assigns memory to the application when requested by the program. It does this through an allocator and can be automatic or manual, depending on the application's programming. 

  • Recycling: The process a program uses to recycle or deallocate memory from an application that no longer requests memory. As with allocation, this process can be automatic or manual. When automated, you can call this process garbage collection.

Memory management techniques

Memory management techniques can be divided into two primary categories: contiguous and non-contiguous memory schemes. Examine different memory management techniques to better understand their purposes. 

Contiguous memory schemes

Contiguous memory schemes are programs that have consecutive memory block addresses and include:

  • Single contiguous allocation

  • Multiple partitioning

1. Single contiguous

Single contiguous memory management schemes are one of the oldest techniques. In this technique, the main memory has two partitions: one for the OS and the other for different user processes. However, due to its simplicity, single contiguous memory management leads to memory waste. While it played an important role in developing more advanced systems, this technique isn’t practical for modern computers.

2. Multiple partitioning

Multiple partitioning overcomes the issues of running concurrent programs by breaking the main memory into various parts or partitions, allowing you to run simultaneous applications and utilize memory more efficiently. Multiple partitioning uses two techniques to achieve this:

  • Fixed partitioning: Functions by breaking the memory into partitions of equal size. Each program, regardless of its size, utilizes an entire partition. A small program may consume more main memory than it needs, or an extensive program might not have enough space within its partition to function correctly, making this a potentially inefficient approach to memory management.

  • Dynamic partitioning: Functions by using partitions of various sizes, and each process is only given the amount of memory it needs to operate. Still, this technique can lead to gaps in the memory, which is called external fragmentation.

Non-contiguous memory schemes

Non-contiguous memory does not depend on the consecutive memory blocks of contiguous memory. Instead, it manages memory blocks of the required size, only sometimes near one another. Noncontiguous memory schemes include:

  • Paging

  • Segmentation

1. Paging

In the paging memory management technique, blocks organize themselves into frames, which are specific-sized blocks of physical memory. The frames do not need to be contiguous, reducing the amount of external fragmentation that occurs in the main memory. Paging is faster, improves main memory usage, is efficient, and is readily swappable. 

2. Segmentation

Segmented memory management further breaks down the paging technique, allowing for the segmenting of blocks into various sizes, but a maximum size limit exists for each segment. This allows for the management of segments into easily programmable pieces of main memory.

Who uses memory management?

Programmers and software developers use memory management to ensure that their programs do not consume too much RAM. Errors in memory management can lead to crashes and computer slowdowns. Memory management is especially important in a language like C++, which uses manual memory management, giving programmers methods to control their memory management closely. Because memory management is the process your computer uses to store information, you can assume that memory management, in some form, is used throughout most industries in the economy.

How to get started in memory management

Programmers and software developers typically require a bachelor’s degree in computer science, with some employers preferring a master’s degree. Both careers require continuing education to learn new languages and keep up with advances in computing technology. Discover some of the jobs you could pursue and their average annual salaries for programmers and software developers:

*All salary data is sourced from Glassdoor as of October 2024

Getting started with memory management on Coursera

Memory management is a vital part of an efficient and high-performing computer system. Understanding memory management is essential for programmers whose software and applications depend on properly allocating memory to function. 

On Coursera, you can find highly rated courses on operating systems and memory management. For example, Introduction to Operating Systems Specialization from Codio covers fundamental information about operating systems, such as virtualization and memory management. Introduction to Hardware and Operating Systems from IBM is another excellent option for learning more about operating systems, the hardware components that help them function, and troubleshooting techniques.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.