A deep look at how Linux uses virtual memory

Don't Forget

© Lead image © lukjonis, 123rf.com

© Lead image © lukjonis, 123rf.com

Article from Issue 281/2024
Author(s):

Virtual memory makes your system safer and more efficient. But what is it really? We take a look inside this powerful feature that is built into Linux.

Like other modern operating systems, Linux is multitasking, meaning that it can manage multiple running processes at the same time. With that great capability, though, comes great responsibility. Linux must ensure that no process can meddle with the memory used by another process. Historically, a vast number of security vulnerabilities were caused by malicious code being executed from a memory area that was intended for ordinary data storage only and not for executable code. The operating system also must ensure that enough memory is available for the needs of all running processes and must take steps to make memory available if there is not enough. All these responsibilities must be fulfilled as quickly as possible, or otherwise performance will suffer.

Fortunately, Linux provides a way to manage the memory resources for many disparate processes simultaneously: virtual memory [1]. Essentially, when a process refers to a memory address, it does not refer directly to a physical memory location. Instead, the memory address is used as an index into one or more tables, which are then used to translate the memory address into a real, physical memory address.

The concept of virtual memory is so well established that modern computer hardware almost always has at least some basic facilities built-in to make virtual memory management easier for the operating system. However, the exact details of how virtual memory is implemented varies from one hardware platform to another. Most of the concepts outlined in this article apply equally to any platform, but I have chosen to use the 64-bit x86 (PC) architecture as the basis for examples.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • maddog's Doghouse

    A look at the history of computer memory and a classic algorithm text.

  • Fresh Memory – Learning Aid

    When memorizing facts, learning, storing, and processing internalizes the subject matter. The Fresh Memory program offers various methods to help you anchor the facts in your memory.

  • Security Lessons: Rescue Tools

    When attackers strike your system, you need to determine exactly what damage has been done. Here are some tools to help.

  • Code Analysis

    Linux offers some sophisticated tools for understanding how malware can slip through the gaps in an unsuspecting application.

  • Hercules Mainframe Emulator

    Many enterprises still rely heavily on mainframes, which makes it all the more difficult to get your hands on one and install Linux on it. The Hercules emulator gives you a full-fledged alternative.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News