Login with Facebook

Memory Management in an Operating System

RAM is a fairly valuable resource, which must be managed according to certain principles. There are different management concepts, which lead to different techniques, with their pros and cons.

The management of main memory (RAM, primary, or as we call it) is one of the most important aspects of the operating systems. Like all computer resources, RAM must also be managed according to the usual principles of fairness and performance.

In particular, memory management must:

· Being economic (low overhead).

· Maximize its use.

A little better, you don't have to waste CPU time putting and taking stuff out of the primary memory, and you have to use all the available space efficiently.

Memory Management Requirements

To ensure efficiency and ease of management, data protection, and a minimum of code portability, we need these requirements.

Protection and Sharing

Generally, we don't want a process to access memory areas of other processes. Imagine having a password manager running: in RAM, you certainly have your credentials in the clear. we are sure you wouldn't like any process to access that piece of memory and read your credentials.

At the same time, however, we also ensure that some memory zones are shared between processes.

Imagine you have a large 500 kB library, which is used by 20 processes: instead of having the library copied in each of the 20 processes (for which 500 * 20 kB = 10 MB), we leave it shared and saved at least 10 MB.


This is a nice concept. let's see what it means.

We know that:

  • The size of the RAM is not the same for each device.
  • The operating system decides where to allocate in memory.
  • A process can be taken out of memory, and put back later (swapping).

 A process must be able to execute its instructions without thinking about where they actually are in RAM. This is the essence of relocation, making the process independent of its memory position. The information is stored in two specialized registers, called the base register and the bounds register, respectively.

In practice, the relocation is implemented by introducing relative addresses, also called logical ones. The process uses these relative addresses, which are then translated by the operating system into real physical addresses. To finish this concept, let's talk about the two types of relocation.


Static Relocation

It is basic and not good. In this phase, all the logical addresses are translated into physical and calculating them starting from the initial one.

· Pros: none.

· Cons: the process is not swappable -> the memory cannot be reorganized.

Dynamic Relocation

It is good and modern technique. We can translate the addresses at runtime.

· Pros: we can relocate the process around the RAM -> we can reorganize the memory

· Cons: none.

Memory Organization

We must distinguish between physical and logical.

· Physically, in memory, we implement overlaying, or we can allocate different modules/processes in the same memory zone, but at different times. Furthermore, the management is done transparently to the user/programmer.

· Logically, we see memory in a linear fashion, with permissions for each module/process.

Memory Management 

The primary memory is a linear space in which the operating system allocates and de-allocates the memory. These two operations seem very trivial in words, but in reality, they are a big problem.

Over the years, several ideas have been introduced to make these operations possible. Modern operating systems use techniques called segmentation and paging (also used together), which allow the main memory to be used efficiently and without waste.


Memory Partitioning

The basic idea of ​​this cave technique was to divide the RAM into blocks of a certain length, called partitions.

The main features were:

· A program in each partition

· No partitioning programs.

We have three types of partitioning:

· Fixed.

· Variable (fixed with variable size).

· Dynamic.

Fixed Partitioning

The idea was to have fixed-length partitions.

This technique required not just hardware support: in fact, it is used to put more than one processes in the main memory. 

It is also quite intuitive to understand the limitations:

· Limited number of processes loaded simultaneously into memory.

· Maximum size of processes given by the size of the partitions.

Furthermore, here we introduce a problem called internal fragmentation.

Variable Partitioning

Some intelligent people realized that there was a fairly intuitive way to reduce internal fragmentation. If we have internal fragmentation, it means we have smaller partition programs.

 Then, if we had partitions with different lengths, we could allocate the programs in the most similar partitions.

Dynamic Partitioning

· No need for memory already partitioned.

· ** Partitions created ad-hoc ** at runtime.

·No internal fragmentation.

·Goodbye process limits.

· Now the maximum size of the process coincides with the size of the RAM.


In fact, there are different algorithms to decide where to allocate new process. They are given below:


· Process allocated in the smallest space that can contain it (the best, by definition).

· High overhead, because finding this space takes time.

· In the long term it brings us more external fragmentation.


· Process allocated in the first free space from the beginning of the memory.

· Low overhead.

· In the long term it tends to crowd the initial part of the RAM.


· Like the first-fit, but starting from the last allocated position (idea derived from the principle of locality).

· Low overhead.

· In the long term, it tends to crowd the final part of the RAM.

Buddy System

This technique is a bit more complex than the previous ones, and the basic idea is to divide the memory into blocks called buddies and allocate the process to use if it respects a specific condition.


Memory Paging

If you like comparisons, we can say that this technique uses some principles of fixed partitioning, but in a modern way.

 Yes, maybe this description is better suited for reviewing a music album, but it's not wrong. Let's see why.

With pagination, both memory and processes are divided into ** small blocks of fixed size ** (typically 512 kB).

We introduce terminology on the fly:

· Pieces of memory: pages.

· Process pieces: frame.

Memory Segmentation

This other system is instead heir to dynamic partitioning.

In fact, each process is divided into segments of variable length.

 For each process, we have a segment table, which maps the pair to the corresponding physical address.

Segmentation allows us to see memory as an address space. There is a problem though: the segments may not be contiguous. in this case, the address space is not contiguous but fragmented. This makes things a little uncomfortable and not very elegant. 


Segmentation on Pagination (or Paged Segmentation)

This method combines segmentation and paging. In practice, we use segmentation to address pages. In this way, we succeed in abstracting the discontinuity of the segments, making the program believe that it has a contiguous address space. Segments and pages remain discontinuous in memoryMemory Management, but we use a system to - in fact - abstract the address space.


Send Comment

Need a custom

We will write it for you.
Order now

Free Essay Examples

Free essays:

All you need to know about the ACA Code of ethics
Architecture and Democracy: An Introduction
Architecture and Democracy: Democratic Values
Architecture and Democracy: Democratic Procedures
All You Need to Know About a Synthesis Essay
An essential guide to understanding Film Theory
Application of Artificial Intelligence in Cyber Security
Applications of electrical engineering
Augmented reality: what it is, how it works, examples
Advantages And Disadvantages Of Social Networking
All you need to know about Cryptography
Applications of astrophysical science
All you need to know about architecture engineering
Applications of geological engineering
Artificial intelligence and medicine: an increasingly close relationship
An insight into Computational Biology
ACA code of conduct
A Rose for Emily
Applications of Mathematics in daily life
Architecture mistakes to avoid
All you need to know about Toxicology
All you need to know about Holistic Medicine
All you need to know about linguistics
An introduction to Linguistics and its subfields
All you need to know about Anxiety disorder
All you need to know about Drones
A Brief Insight into Political Science
Assumptions related to feminism
All you need to know about Byzantine emperors
All you need to know about labour economics
An insight into xenobots -the first-ever robots
An ultimate guide about Biomaterials
Biomedical engineering trends to look out for
Bionic Limbs and Technology: Advancements Improving Patients' Lives
Bipolar disorder: Symptoms, causes, diagnosis and treatment
Biochemistry of neurotransmitter
Brain-Computer Interface systems with EEG signals
Consequences of racial discrimination in urban housing development
Cryptocurrency: Advantages and Disadvantages
Character Archetypes: The Good
Character Archetypes: The Bad
Contemporary art trends
Commonly Confused Words
Commonly Confused Words: Part 2
Characteristics of the byzantine architecture
Data Visualization: What it is and why it matters?
Data Science: Fundamental tools for data analysis
Different forms of dance you should know about
Digital Imaging: What Is It?
Dynamic Systems Modeling with Machine Learning
Eat To Live or Live To Eat
Everything you need to know about WiMAX
Everything you need to know about Data Science
Everything you need to know about Virtual memory
Entrepreneur trends to know about
Effects of Different Environmental Factors on Artworks
Film styles and the types of styles for shooting a film
Famous African American literature authors
How to Write a Personal Essay
Housing Needs in America
How to Write a Description Essay
How to Create an Excellent Scholarship Essay?
How to write a cause and effect essay
How to Hire the Best Essay Writing Service Provider?
How to Write a College Application Essay?
How to get the most out of your English lectures
How to write Expository Essay
How to succeed in your psychology class?
How to Write an Academic Essay in the Shortest Time?
History of Journalism
How Different Sectors are Using Artificial intelligence (AI)
How to write an informative essay
How to deliver persuasive essays?
How to Give a Convincing Presentation
How to write an essay on leadership?
Historical Art Still Around Today
Humanoid robot: what it is, how it works and price
History of Chemistry
Healthcare Advanced Computer Power: Robotics, Medical Imaging, and More
Healthcare AI: Game Changers for Medical Decision-Making and Remote Patient Monitoring
How to understand different types of English
How to Cope with Chronic Pain
How African American choreographers and dancers have influenced American dance
How mobile robot can do in logistics or in production
How To Become a Successful Entrepreneur
History of the Philosophy of Feminism
How is the climate changing?
How to Track Your Content Marketing ROI
How to Gun control In the USA?
Historical and contemporary role of labour in the modern world
Introduction to Urban Studies
Importance of dance in education
InMoov: how to build an open source humanoid robot
Importance of KYC verification to making the Blockchain secure
Importance of Rhythm
Importance of dance student evaluation
I/O control methods -types and explanations
Identity theft: what to do?
Introduction to Utilitarianism
Know about the history of science
Know about the different forms of traditional African dances
Latest dance trends
Latest technology trends
Modern sociology trends you should know about
Modern Art that the Past Would Have Scorned
Modern Art that the Past Would Have Scorned, Part 2
Memory Management in an Operating System
Misconceptions About the Word “Introvert”
Major healthcare trends
Nuclear fusion: What it is and how it works?
Neural networks: what they are and what they are for
Philosophy of Art: Written Forms as Art
Robotic Integration into Our Lives: Now and the Future
Role of a neuroscientist
Risk management, meaning, and importance for companies
Role of gender studies
Role of a digital artist
Should You Start a Career Or Enter University At 18?
Smoking Should Be Banned
Should You Go Digital?
Standard finance terms to know about
Social robots
Schizophrenia - a rare psychiatric illness | Essay
The Looming Energy Crisis in America
Top benefits of performance-based engineering
The More Languages You Know, The More Times You Are a Man
Things to consider while writing an Argumentative Essay
Top Ways to Improve Your Academic Writing Skills
Tips to Excel in Creative Writing
The origins of films in the early 19th century
Top career options in Architecture
The Elevator Pitch
Top finance trends 2020
The basic Structure and functionality of robots
The Way to Success
The election system of the President in the United States of America
Two-party System in United States of America
Top trends in urban design
The history and theory of African American filmmaking
Top benefits of creative writing
Tinnitus Guide: Common Symptoms and Treatment Options
The language of dance
The digital image processing management
Top famous politicians of the World
Top methods of political science!
The history of the feminist movement
The blood flow in cardiovascular system - Biofluid Mechanics
Understanding the sociology of Race & Ethnicity
Urban planning in the US
Virtual reality, what it is and how it works
Various theoretical perspectives of sociology
What is a Definition Essay?
What are diagnostic essays?
What is the relation between art structural engineering?
What is a Narrative Essay
What are robotics and intelligence systems?
What are the benefits of studying health sciences?
What is artificial intelligence and why it matters?
What is comparative Literature?
Why study neuroscience
What is Wi-Fi and how does it works
What is French history famous for?
What are Humanistic Studies?
What is covered in Biophysics?
What is modern journalism?
What is Virtualization? Benefits & Applications
What are modern public relations?
What is plasma physics?
What is teacher preparation?
What is rapid prototyping for 3D printing?
What is contemporary European Politics?
Why should you learn American Ballet?
What is engineering physics?
What is the purpose of African American Literature?
Ways to learn the Rhythm
What is digital art used for?
What are Enzymes and how do they work
Who is the father of political science?
Why Study Political Science - Job?
What is the Philosophy of Feminism?
What is a quantum computer?
Ways B2B Startups Streamline Their Conversion Strategies
Why do biomedical signals need processing?
What are the long term effects of climate change?
Why study labour relations
What is Holoprosencephaly?
4 Facts about Origin of Mathematics!
5 techniques to create an animation
13 Best colleges for political science in the world