OSY Understanding Virtual Memory in Operating Systems
OSY Understanding Virtual Memory in Operating Systems
(Polytechnic)
Department of Computer Engineering
SEMESTER-5th 2024-25
DEPARTMENT OF
COMPUTER ENGINEERING 2024-25
THIRD YEAR [5th Semester]
MICRO PROJECT REPORT OF
OPERATING SYSTEMS ON
CERTIFICATE
This is to certify that report entitled is “Understanding Virtual Memory in Operating
Systems” submitted in the partial fulfillment of requirement for the award of the
Diploma in Computer Engineering by Maharashtra State Board of
Technical Education as record of students' own work carried out by them under
the guidance and supervision at Ajeenkya DY Patil School Of Engineering
(Charholi), during the academic year 2024-25.
guide Mrs.Mayuri Narudkar She has been guide in the true sense of
We appreciate the assistance of all staff that helps us in for their sincere
3. Proposed Methodology:
Research Key Concepts: Study virtual memory, focusing on paging,
segmentation, and memory management.
Data Collection: Gather information from reliable sources like
textbooks and research papers.
Analysis: Compare virtual memory implementations across different
operating systems.
Team Roles: Assign specific topics to team members.
Report Compilation: Summarize findings and recommendations in
the final report.
4. ACTION PLAN:
Sr. No. Details Of Planned Planned Name Of
Start Date End Date
Activity Responsible
Group Members
1 Satyam Gagare
Searching for the topic
Prasad Thikekar
2 Confirmed the topic we
searched for
Prasad Sathe
for the micro project
3 Collecting information
4 Making proposal
6 Preparation of final
project report
2 Chrome -
3 Microsoft word -
Mrs.Mayuri Narudkar
(Project Guide)
Introduction
• This represents the actual memory addresses in the system's RAM. The
operating system manages this space, allocating it to processes as needed.
3. Translation Mechanism
• The operating system maintains a page table for each process. This table
records the mapping between logical addresses (pages) and their
corresponding physical addresses (page frames).
5. Paging Mechanism
• The logical address space is divided into fixed-size units called pages,
while the physical memory is divided into page frames of the same size.
6. Segmentation (Optional)
7. Demand Paging
o It may swap out a less frequently used page (if memory is full) to
make room.
o The required page is loaded from disk into RAM, and the page
table is updated to reflect the new mapping.
2. Isolation of Processes:
4. Error Containment:
2. Isolation of Processes:
4. Error Containment:
2. Demand Paging:
4. Performance Optimization:
1. Paging
Division of Memory:
• When a program runs, its pages can be mapped to any available page
frames in RAM, allowing for non-contiguous storage.
2. Segmentation
Organization of Memory:
• Each process has its own page table that contains entries mapping each
page to its corresponding frame in physical memory.
When a logical address is accessed, the CPU consults the page table. If the entry
is invalid, a page fault occurs, prompting the OS to load the page from disk.
• The TLB is a small cache in the CPU that stores recent virtual-to-physical
address translations.
• When the CPU generates a virtual address, it first checks the TLB for a
cached translation (a TLB hit). If found, access is quick; if not (a TLB
miss), the system accesses the page table, which is slower.
• The TLB uses its own replacement policy (like Least Recently Used) to
keep frequently accessed entries available.
Memory Management Techniques
1. Demand Paging
Definition: Demand paging is a memory management technique that loads pages into
physical memory only when they are needed by a running process. Instead of loading an
entire program into RAM, only the necessary pages are loaded, optimizing memory usage.
How It Works:
• When a program accesses a page that is not currently in memory, a page fault occurs.
The operating system handles this fault by retrieving the required page from
secondary storage (usually a hard drive or SSD) and loading it into RAM.
• This approach minimizes the amount of physical memory needed at any given time,
allowing more processes to run concurrently, even if their total memory requirements
exceed physical RAM.
• Demand paging enhances efficiency by reducing the initial loading time for
applications and ensuring that only actively used pages consume memory resources.
Benefits:
• Reduced Memory Usage: By loading only the required pages, demand paging
significantly reduces the overall memory footprint.
• Improved Performance: Applications can start faster since not all pages need to
be loaded upfront.
2. Swapping
How It Works:
• When the operating system needs to free up memory, it can swap out a process that is
currently in RAM to a designated area on the disk (swap space or swap file). This
allows new processes or pages to be loaded into RAM.
• When the swapped-out process is needed again, it is swapped back into RAM,
potentially evicting another process.
Benefits:
Definition: Page replacement algorithms are techniques used by the operating system to
manage memory when a page fault occurs and the physical memory is full. These algorithms
determine which page to evict from RAM to make space for a new page.
Common Algorithms:
o This algorithm replaces the page that has not been used for the longest period.
LRU is more effective than FIFO because it bases its decisions on the most
recent access patterns, thus better reflecting the working set of the program.
Definition: Virtual memory allows the operating system to use physical memory (RAM)
more efficiently by abstracting the memory management process.
How It Works:
• Virtual memory creates an illusion for applications that they have access
to a large, contiguous block of memory, even if the physical memory is
limited. This abstraction allows the system to allocate memory more
flexibly and avoid fragmentation issues.
• By loading only the necessary pages into RAM and using demand paging,
the operating system ensures that memory is utilized only for active
processes. Inactive pages can reside on disk until needed.
Benefits:
2. Multitasking Support
How It Works:
• Each process is given its own virtual address space, allowing it to operate
independently from others. The operating system manages these spaces,
ensuring that processes do not access each other’s memory.
• The ability to swap processes in and out of RAM without stopping them
allows the OS to maintain a responsive user experience, even when
running multiple applications.
Benefits:
How It Works:
How It Works:
• Each process running in an operating system has its own page table that
maps virtual addresses to physical addresses. When a process needs to
access memory, the operating system must check the corresponding entry
in the page table.
• The size of the page table can grow significantly with larger address
spaces, especially in systems with many processes or large amounts of
virtual memory.
Challenges:
Impact on Performance:
How It Works:
• When the system runs low on physical memory, it may resort to excessive
swapping to accommodate active processes. If too many processes are
active and competing for limited RAM, the operating system
continuously swaps pages, causing a severe performance drop.
• As pages are repeatedly swapped in and out, the CPU remains busy
managing these operations rather than executing the application
instructions.
Challenges:
Impact on Performance:
3. Resource Consumption
• The process of managing virtual memory requires CPU resources to handle page
faults, manage page tables, and execute page replacement algorithms. Each of these
tasks consumes CPU cycles, which could otherwise be allocated to executing
applications.
• Additionally, virtual memory relies on disk space for swap files or swap partitions. If
the disk becomes full or nearly full, system performance can degrade, leading to
increased latency.
Challenges:
• Disk I/O Bottlenecks: Excessive use of swap space can lead to increased disk
I/O, resulting in bottlenecks that slow down system performance. This can be
especially problematic in systems with slower hard drives compared to RAM speeds.
Impact on Performance:
• While virtual memory provides significant benefits, it is crucial to consider the trade-
offs in resource consumption. Striking a balance between efficient memory
management and resource utilization is essential for maintaining system performance.
Virtual Memory in Different Operating Systems
1. Windows
Key Features:
Benefits:
Key Features:
• Page Tables: Each process has its own set of page tables that
Linux manages through a hierarchical structure, optimizing
memory access and reducing overhead.
Benefits:
Key Features:
Benefits:
1. Paging Diagram:
• Description: A diagram showing the relationship between virtual
memory and physical memory, divided into fixed-size blocks called
pages.
o Virtual Memory divided into pages (e.g., Page 0, Page 1, Page 2).
2. Segmentation Diagram:
o Each segment should show its size and base address in physical
memory.