0% found this document useful (0 votes)
9 views

Parallel Virtual Memory presanation

Uploaded by

Harris Chikunya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Parallel Virtual Memory presanation

Uploaded by

Harris Chikunya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Virtual Memory

Elton Daka R222461H


SEAN NYAMUROWA R227191H
Kundai Mushura R224087H
Mmichelle Sambawamedza
R231851H
Principal of operation
 Virtual memory is a memory management technique that allows a
computer to use more memory than is physically available in the system's
RAM (Random Access Memory). Virtual memory uses both hardware and
software to enable a computer to compensate for physical memory
shortages, temporarily transferring data from random access memory (RAM
) to disk storage. Mapping chunks of memory to disk files enables a
computer to treat secondary memory as though it were main memory.
Here's how it works:
 Principle of Operation:1. Memory Virtualization: The operating system
creates a virtual address space for each process, which is a logical
representation of memory.
 2. Paging: The virtual address space is divided into smaller fixed-size blocks
called pages (typically 4KB).
 3. Page Table: Each process has a page table that maps virtual pages to
physical frames (RAM) or disk pages (hard drive).
 4. Page Fault: When a process accesses a page not in RAM, a page fault
occurs, and the OS checks if the page is on disk.
 5. Page Replacement: If the page is on disk, the OS swaps it with an
existing page in RAM, freeing up space.
 6. Disk Swap Space: The OS uses a designated area on the hard drive
as swap space to store pages temporarily.
 Key Components
 1. Memory Management Unit (MMU): Handles virtual-to-physical
address translation.
 2. Page Table: Maps virtual pages to physical frames or disk pages.
 3. Swap Space: Disk area used to store pages temporarily.
 Benefits
 1. Memory Abstraction: Virtual memory provides a layer of
abstraction, allowing processes to use more memory than physically
available.
 2. Efficient Memory Use: Pages are swapped in and out of RAM as
needed, optimizing memory utilization.
 3. Multi-Programming: Multiple processes can run concurrently,
sharing the same physical memory.
 Challenges
 1. Page Faults: Frequent page faults can lead to performance
degradation.
 2. Thrashing: Excessive paging can occur when processes require
 Demand paging
 is a memory management technique used in virtual memory systems.
 Demand paging is a method of loading pages into memory only when they are actually
needed (on demand). This approach reduces memory usage and improves system
performance.
 How Demand Paging Works
 Page Table: The operating system maintains a page table for each process, 1.which
keeps track of virtual pages and their corresponding physical frames or disk locations.
 2. Page Fault: When a process accesses a page not in memory, a page fault occurs.
 3. Page Loading: The OS checks if the page is on disk and loads it into memory if
necessary.
 4. Page Replacement: If memory is full, the OS replaces an existing page with the
newly loaded page.
 Key Characteristics:
 1. Lazy Loading: Pages are loaded only when needed, reducing memory usage.
 2. On-Demand: Pages are loaded in response to page faults.
 3. Page Replacement: The OS manages page replacement to optimize memory usage.
 Advantages
 1. Efficient Memory Use: Demand paging reduces memory waste by loading only
needed pages.
 2. Improved Performance: By minimizing page faults, demand paging enhances
system responsiveness.
Disadvantages
1. Page Fault Overhead: Frequent page faults can lead to performance
degradation.
2. Thrashing: Excessive paging can occur if processes require more memory
than available.
Page replacement
It is a crucial aspect of virtual memory management.It is the process of
swapping out a page from memory to make room for a new page. This
occurs when a page fault happens and no free frames are available.

Page Replacement Algorithms


These algorithms decide which page to replace when a new page needs to
be loaded. The goal is to minimize page faults and optimize system
performance.

2. First-In-First-Out (FIFO)- Replaces the oldest page in memory.


3. 2. Least Recently Used (LRU)- Replaces the page that hasn't been
accessed for the longest time.
4. 3. Optimal Algorithm-Replaces the page that won't be needed for the
longest time (ideal but impractical).
Key Considerations:
1. Page Fault Rate- The frequency of page faults.
2. Memory Utilization- Balancing memory usage and page faults.
3. Performance Overhead-Minimizing the overhead of page replacement.

FIFO (First-In-First-Out)- Replaces the oldest page in memory- Easy to


implement- Can lead to high page fault rates if pages are reused- Not suitable
for systems with high page reuse rates

7 0 1 2 0 3 0 4 2 3 0 3 1 2 0
7 7 7 2 2 2 2 4 4 4 0 0 0 0 0
0 0 0 0 3 3 3 2 2 2 2 1 1 1
1 1 1 1 0 0 0 3 3 3 3 2 2

Page hit =3 hit ratio =no of hits/total no of references


=3/15x100
=20%
Page faults=12 fault ratio=12/15x100
=80%
 Least Recently Used
LRU
- Replaces the page that hasn't been accessed for the longest time
- More effective than FIFO in reducing page faults
-Can be implemented using a linked list or stack
- May still lead to high page fault rates if pages are reused frequently

7 0 1 2 0 3 0 4 2 3 0 3 1 2 0
7 7 7 2 2 2 2 4 4 4 0 0 0 2 2
0 0 0 0 0 0 0 0 3 3 3 3 3 0
1 1 1 3 3 3 2 2 2 2 1 1 1
 OPTIMAL
 - Replaces the page that won't be needed for the longest time
 - Theoretically optimal, but impractical to implement
 - Requires knowledge of future page accesses, which is impossible to
predict
 - Used as a benchmark to evaluate other algorithms

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7
7 7 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
0 0 0 0 0 0 4 4 4 0 0 0 0 0 0 0 0
1 1 1 3 3 3 3 3 3 3 3 3 1 1 1 1 1
Thrashing
It is a critical concept in virtual memory management!
- occurs when a system spends more time swapping pages between
memory and disk than executing actual processes.
 This leads to
 :1. High page fault rates
 2. Excessive disk I/O
 3. Reduced system performance
 4. Increased CPU utilization (due to overhead of page replacement
 Causes of Thrashing
 1. Insufficient memory
 2. Poor page replacement algorithms
 3. High page reuse rates
 4. Overcommitting memory to processes
 Symptoms ofThrashing
 :1. System slowdown
 2. High disk activity
 3. Increased CPU usage
 Solutions to Thrashing:
 1. Increase physical memory
 2. Implement efficient page replacement algorithms (e.g., LRU, Clock)
 3. Reduce page size
 4. Use memory-mapped files or shared memory
 5. Optimize application memory usageThrashing is a common issue in
systems with limited memory or poor memory management.

You might also like