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.


Relocation


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:


Best-Fit


· 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.


First-Fit


· 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.


Next-Fit


· 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.


Comments





Send Comment

Need a custom
essay?

We will write it for you.
Order now

Free Essay Examples

Free essays:

All you need to know about Smart prosthesis
Asian vs. western leadership styles
All you need to know about the epidemiology
Applications of BIOMEMS
Broadcasting: How to Be Good In Front of the Camera
Bioconjugates for the Drugs Delivery
Big data analysis in evolutionary biology
Brain-Computer Interface systems with EEG signals
Cochlear implant: what it is and how it works
Current challenges to the health of women
Current challenges to the health of Adolescence
Competitive strategies for modern businesses
Doppler ultrasound or simply eco Doppler
DNA extraction
Dynamic Systems Modeling with Machine Learning
Digital Imaging: What Is It?
Everything you need to know about the capital market
Entrepreneurship: Conceptual Framework for Evaluating Technology
Entrepreneurship: Opportunity and Design Thinking
Everything you need to know about enzymatic kinetics
Factors about The Savings Investment Process
Financial intermediaries and its Types
Fascias: all about fibrous membranes
Funding sources for non-profit organizations
Genetic regulation networks: modeling in biology
How to make your business survive at economic crisis
How to choose the topic of the senior capstone project
Healthcare technologies that help patients with better self-management
Introduction of Microfabrication techniques
Introduction to Writing a TV Script
Introduction to Journalism
Importance of modern trade policy
Journalism: What is News?
Journalism: Broadcast media and Television Presenters
Journalism: Sources of News
Journalism and Law
Kinetic models in biology and Related fields
Know about the different forms of traditional African dances
Know about the history of science
Latest technology trends
Microfluidics and microfluidic chips
Molecular Imaging
Modern conservatism in America
Modeling and simulation of genetic regulatory networks
Nanomedicines to target tumors
Nonlinear Dynamics in Biology & Biomedicine
NLS (Nonlinear System) - Revolutionary system in diagnostic medicine and therapy
Neural networks: what they are and what they are for
Overcoming Hiring Challenges for Nonprofit Organization
Principle of Optical coherence tomography (OCT)
Politics and Religion: Relations and Conflict Issues
Principle and parameters of Volumetric computed tomography
Role of technology in the modern business environment
Role of Homeostasis in Human Physiology
Role of a digital artist
Role of gender studies
Skills in Journalism: Effective Interview
Systems biology - An understanding the functioning of biological systems
Self-assembly for biological systems
School of American Ballet
The Structure of Interest Rates and the Yield Curve
The New Media: Emerging Trends
The technical basis of optical coherence imaging
The Principles of MRI Contrast agents
Ultrasound: physical principles and image formation
Understanding social entrepreneurship
Understand the importance of investigative journalism
Urban planning in the US
Various theoretical perspectives of sociology
Virtual reality, what it is and how it works
What is the purpose of deep brain stimulation?
What is transition elastography?
4 Facts about Origin of Mathematics!
5 techniques to create an animation
13 Best colleges for political science in the world
3d Model Of Building
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
A Comprehensive Introduction to the Mona Lisa
Analysis methods of Transport through biological membranes
An ultimate guide about biochemical reactions
Analysis of brain signals
Artificial Gene Synthesis
Application to synthetic biology of CAD methods
All you need to know about metabolic pathways
Applications of BIOMEMS
All you need to know about the epidemiology
Asian vs. western leadership styles
All you need to know about Smart prosthesis
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
How breast cancers are classified?
How the cells of our body communicate?
How the Lymphatic System Works?
How Digestive System Works
How to complete your capstone projects effectively?
How to write a research project
Healthcare technologies that help patients with better self-management
How to choose the topic of the senior capstone project
How to make your business survive at economic crisis
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
The best of Leonardo Da Vinci
The Structure and Function of Macromolecules
The structure of cell: a research on the bricks of the human body!
Tissue and organ construction: Adhesion and recognition between cells
The kinetics of the transformation processes
The Modeling of Biological Systems
Tips for writing a great thesis statement
The Defense mechanisms against infections
The impact of the technological innovations in medicine
Top journalism trends to know about
The relation between mass media & politics
Theranostics: Diagnosis and Care through Nanoparticles
The practical Applications of X-rays
The applications of Ultrasound in medicine
Transfer mechanisms of genetic information in Bacteria
The regulation of cellular metabolism in the diagnosis
The Principles of MRI Contrast agents
The technical basis of optical coherence imaging
The New Media: Emerging Trends
The Structure of Interest Rates and the Yield Curve
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?
What is antisocial disorder?
What are the important principles of evolution?
What is the cytoplasm and its function?
What is biopolymers?
What Makes a Good Leader
Women empowerment in modern generation
What is the history of political thought?
What is Gene recombination
What is synthetic biology
What is business cost analysis?
What is Inflation
What are the consequences of unemployment?
What is lithotripsy and its types?
What is transition elastography?
What is the purpose of deep brain stimulation?