Login with Facebook

Everything you need to know about Virtual memory

Virtual memory consists of virtualizing the address space. It is an operating system mechanism that requires hardware support. Here we will discuss what the virtual memory is and how it works. Let’s delve into it!

What is Virtual Memory?

Virtual memory is a mechanism of the operating system that allows running programs larger than RAM. It gives the illusion to the processes of having potentially unlimited space. The immediate consequences are these:

· We can have processes larger than the free space in RAM.

· We can process data larger than the free space in RAM.

It looks like witchcraft because we know that everything that needs to be processed must reside in primary memory. In fact, the thing that makes virtual memory brilliant is that we use the disk as if it were RAM.

In reality, it is not really so, instead, it is not entirely correct.

We have to say that we use secondary memory to temporarily support pieces of processes/data that we do not need at this time, and that probably will not serve us for a while.

Imagine this scenario:

1. You must perform a process.

2. Load only the first pages in RAM.

3. The rest allocate them on the disc.

4. As the process requires more pages, you take them from the disk and swap them to RAM.


1. You have some RAM processes.

2. You have to load another process, but you have no free space.

3. Take a piece of another process, whose pages haven't been used for a long time.

1. In the newly freed space, go to load the first pages of the new process.

A beautiful saved, right?

We have just introduced a term: swap, which indicates a transfer between primary and secondary memory more precisely:

·     Swap in disk -> RAM.

·     Swap out RAM -> disk.

Addressing in Virtual Memory (Segmentation on Pagination)

Now that we know what virtual memory is let's see how addressing works.

Since we use RAM and disk a bit in the same way, we should have an address that takes this property into account. In fact, virtual addresses are used both to address pages in RAM and on disk.

 A virtual address is a triple formed by <segment number. page number. offset>

Below this address, we have the two familiar levels of segmentation and paging.

Line segment table : < control bit. length. base of the segment>.

 Row page table : < P. M. control bit. frame number>.

We realized that page addressing is now slightly different. In particular, we have added two bits Ped M.

· P (present): indicates that that page is currently in RAM, and not on disk.

· M (modified): indicates that the page has been modified.

Before continuing with the translation of the addresses, it is smart to remember that:

· Each process has its own table of segments, which directs points of leaving and length of its various segments.

· Each process has various page tables, which address various pages.

· Each segment addresses a specific page table.

Well, let's see the general scheme of addressing.

 If you find something out of place, give one back to the three things we remembered a moment ago.

It may be useful to have a commentary on the image just seen:

1. We have a virtual address, therefore: a segment number, a page number, and an offset.

2. We also have the pointer to the segment table for the process.

3. Let’s take the segment table, and go to the line denoted by segment number

4. In that line we find the address of the page table for that segment.

6. Let's take that page of the pages, and go to the line denoted by 

 page number. In that line, we find the number of frames.

7. Let's take the RAM and go to the address denoted by that number of frames, and move to it based on the offset.


Page Swap Policies

Ok, we know what swap is. Imagine now that you have a situation where the system is in a constant state of swap in and out. This phenomenon is called thrashing. Since swap is expensive, with thrashing, we are going to devastate system performance heavily. We realize that there is always the general principle of the locality that winks at the corner.

Fetch Policy (upload policies)

This type of Policy decides how to load pages into RAM.

When there is a reference to a page not present in memory, we have a page fault, which triggers the fetch mechanism, or * replacement * (which we will see shortly).

We have two types of fetch policies:

·     On-Demand Paging: load page as soon as it is referenced, initially causes many page faults.

· Preparing: loads several contiguous pages (locality principle).

· Replacement Policy (replacement policies)

· Decide which page to replace, if necessary.

 These policies are quite important, in fact, we have different algorithms to implement them. The quality of an algorithm is determined by the number of page faults that it triggers.

· The replaced pages are then inserted into a page buffer, which typically divides between modified and non-modified pages.

 After a page fault, before loading the page from the disk, the memory manager checks its presence in the page buffer.

· Let's look at these five-page replacement algorithms.

· OPT (Optimal Replacement)

· It is a utopian optimal replacement of the pages.

 It is not feasible because it involves replacing the page that will be used later, which we cannot know.

· LRU (Least Recently Used)

· Replaces the recently used less page.

 It needs a label that represents the time of use.

· FIFO (First in - First Out)

· Replaces the page in memory for the longest time. It's like a circular buffer.

 Simple and cute, too bad that it does not take advantage of the principle of locality. So it sucks us.


We call it a clock because we can represent it graphically as a clock in which:

· Instead of numbers we have pages.

· Each page is assigned a use bit (or reference bit) with values ​​{0, 1}

· The hand acts as a pointer.

From a general point of view, we can say that the clock algorithm works like this:

· The pointer points to the oldest page.

· Initially the use bit is 0.

· When referencing a pageVirtual memory, its bit increments to 1. The bit of the pages encountered by the pointer (hand) up to the referenced page is set to 0.

· The page to be replaced is the first that the hand encounters with a 0 use bit.

This algorithm is also called second chance because pages with use bit 1 are given a second chance to remain in memory.


Send Comment

Need a custom

We will write it for you.
Order now

Free Essay Examples

Free essays:

Analysis of Business Cycles
Analysis of Fiscal and Monetary Policies
An Overview Of Economic Studies
A Guide to Pricing Strategies
Biosensors for cancer diagnosis
Business Analysis: Pricing strategies and Demand Curve
Broadcasting: How to Be Good In Front of the Camera
Bioconjugates for the Drugs Delivery
Cells of Immune system
Challenges that IT Managers are facing
Cochlear implant: what it is and how it works
Current challenges to the health of women
Doppler ultrasound or simply eco Doppler
DNA extraction
Dynamic Systems Modeling with Machine Learning
Digital Imaging: What Is It?
Economy analysis: Business Cycle and Economic Trends
Exchange rate and foreign currency risk
Economic Factors Affecting Decision Making In A Business
Economy Analysis: Inflation, Unemployment And Policies
Factors Influencing Interest and Exchange Rates
Fiscal and Monetary Policies in Response to 2008/2009
Fermentation: how it works and what it is used for
Financial Markets and Functions
Genetic regulation networks: modeling in biology
How can immigrants blend in the American society?
How to make your business survive at economic crisis
How to choose the topic of the senior capstone project
Importance of corporate sustainability
Interaction of Consumer and Firm Choices in Markets
Introduction to Microeconomics
Introduction of Microfabrication techniques
Journalism: What is News?
Journalism: Broadcast media and Television Presenters
Journalism: Sources of News
Journalism and Law
Key Determinants of National Income
Key Factors That Affect Pricing Decisions
Kinetic models in biology and Related fields
Know about the different forms of traditional African dances
Latest technology trends
Latest dance trends
Methods of labeling of nucleic acid that enable their detection
Macroeconomics: International Economic Issues
Neuromuscular disorders
National Economies, Fluctuation, and Responses to Fluctuations
Neurotransmitters: what they are and different types
Nanomedicines to target tumors
Overcoming Hiring Challenges for Nonprofit Organization
Principles of Microeconomics - Producer Theory
Principles of Microeconomics - Consumer Theory
Principles of Economics
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
Types of corporate responsibility
The Role of Government Policy in Improving Economic Outcomes
Types of bioreactors and their applications
Technological perspectives and reflections of neural engineering
Understanding Perfect and Imperfect Competition
Ultrasound: physical principles and image formation
Understanding social entrepreneurship
Understand the importance of investigative journalism
Various theoretical perspectives of sociology
Virtual reality, what it is and how it works
What are the Causes of financial instability?
What is business ethics and code of ethics
4 Facts about Origin of Mathematics!
5 techniques to create an animation
10 strategies to maximize corporate profits
13 Best colleges for political science in the world
6 Medical Technologies that revolutionized the healthcare in 2020
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
Analysis of Economy: Output of Goods and Services (GNP), and GDP on Economic success
A Guide to Pricing Strategies
An Overview Of Economic Studies
Analysis of Fiscal and Monetary Policies
Analysis of Business Cycles
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
How can immigrants blend in the American society?
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
Technological perspectives and reflections of neural engineering
Types of bioreactors and their applications
The Role of Government Policy in Improving Economic Outcomes
Types of corporate responsibility
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?
What is a Brain-Computer Interface (BCI)
What is neuroethics?
What is Market and Supply and Demand
What is optogenetics?
What are the techniques to record brain activity?
What happens if the interest rate increases?
What is immunotherapy?
What is the economic role of the financial market?
What are the factors behind illegal immigration?
What is the lymphocyte activation?
What is financial market and its types?
What is the structure of financial markets?
What are the methods of measuring business performance?
What is the Credit market?
What is business ethics and code of ethics
What are the Causes of financial instability?