IT501 Operating System - Unit 4

Virtual Memory, Page Replacement & Operating System Security

Premium textbook-style notes for RGPV IT501 Operating System Unit 4. This page explains virtual memory, cache memory organization, demand paging, page replacement algorithms, frame allocation, thrashing, demand segmentation, operating system security, security breaches, system protection and password management.

Unit 4 Exam Focus

Virtual MemoryHigh
Demand PagingHigh
FIFO / LRU / OptimalVery High
ThrashingHigh
OS SecurityMedium

IT501 Unit 4 Syllabus

All topics below are arranged according to the RGPV IT501 Operating System Unit 4 syllabus.

Concepts of Virtual Memory
Cache Memory Organization
Demand Paging
Page Replacement Algorithms
Allocation of Frames
Thrashing
Demand Segmentation
Role of OS in Security
Security Breaches
System Protection
Password Management
\

1. Concepts of Virtual Memory

Virtual Memory is one of the most important memory management techniques used by modern operating systems. It allows the execution of large programs even when the available RAM is smaller than the program size. Instead of loading the complete program into RAM, only the required part is loaded whenever it is needed. This technique increases the efficiency of memory utilization and allows multiple programs to execute simultaneously.

Exam Definition:
Virtual Memory is a memory management technique that creates the illusion of a larger main memory by using secondary storage as an extension of RAM.

Why Virtual Memory is Required?

  • Allows execution of programs larger than physical memory.
  • Improves CPU utilization.
  • Supports multiprogramming.
  • Reduces memory wastage.
  • Provides better memory management.

Working of Virtual Memory

Program Starts
Required Page Requested
Check RAM
If Available → Execute
If Not Available → Load From Disk
Continue Execution
CPU ↓ Virtual Address ↓ Memory Management Unit (MMU) ↓ Physical Address ↓ RAM ↓ If Page Missing ↓ Hard Disk

Advantages

  • Runs very large applications.
  • Improves memory utilization.
  • Supports multitasking.
  • Reduces loading time.
  • Provides better system performance.

Disadvantages

  • Page faults reduce speed.
  • Requires secondary storage.
  • Complex memory management.
  • Can cause thrashing if memory is insufficient.
★★★★★ RGPV Exam Tip Virtual Memory is one of the most frequently asked long-answer questions.

2. Cache Memory Organization

Cache Memory is a very high-speed memory located between the CPU and the Main Memory. Its main purpose is to reduce memory access time by storing frequently used instructions and data. Whenever the CPU requests data, the cache is checked first. If the required data is available, execution becomes much faster.

CPU ↓ Cache Memory ↓ Main Memory (RAM) ↓ Secondary Storage

Need of Cache Memory

  • Bridges CPU and RAM speed difference.
  • Reduces average memory access time.
  • Improves overall computer performance.
  • Stores frequently accessed data.

Cache Mapping Techniques

Technique Description Speed
Direct Mapping Each memory block maps to one cache location. Fast
Associative Mapping Any memory block can occupy any cache location. Very Fast
Set Associative Mapping Combination of Direct and Associative Mapping. Balanced

Advantages

  • Very high speed.
  • Improves CPU efficiency.
  • Reduces memory delay.
  • Increases system performance.

Disadvantages

  • Expensive memory.
  • Limited capacity.
  • Complex design.
★★★★★ Remember the three cache mapping techniques. Questions based on comparison are frequently asked.

3. Demand Paging

Demand Paging is a virtual memory technique in which pages are loaded into memory only when they are actually required. Instead of loading the complete process into RAM, only the demanded page is brought into memory. This saves memory space and improves system efficiency.

Definition: Demand Paging loads pages into main memory only when they are needed for execution.

Working of Demand Paging

CPU Requests Page
Check Page Table
Page Present?
YES → Execute
NO → Page Fault
Load Page From Disk
Update Page Table
Continue Program
Program ↓ Page Table ↓ Page Present? ↓ Yes → Execute ↓ No ↓ Page Fault ↓ Load From Disk ↓ Resume Execution

Page Fault

A Page Fault occurs when the required page is not present in RAM. The operating system interrupts the current execution, loads the missing page from secondary storage, updates the page table and restarts the instruction.

Advantages

  • Efficient memory utilization.
  • Loads only required pages.
  • Supports large applications.
  • Improves multiprogramming.

Disadvantages

  • Frequent page faults reduce performance.
  • Requires additional hardware support.
  • Disk access is slower than RAM.
Demand Paging Normal Paging
Loads only required pages. Loads all pages.
Less memory usage. Higher memory usage.
Better efficiency. Less efficient.
Can generate page faults. No page faults during initial execution.
★★★★★ Expected Question Explain Demand Paging with Page Fault using a neat diagram.

4. Allocation of Frames

A frame is a fixed-size block of physical memory. When a process executes using paging, the operating system must decide how many frames should be allocated to that process. This process is known as Frame Allocation.

Definition:
Frame allocation is the process of assigning physical memory frames to processes for execution.

Objectives of Frame Allocation

  • Efficient utilization of main memory.
  • Reduce page faults.
  • Improve CPU utilization.
  • Provide fair memory allocation to all processes.

Frame Allocation Techniques

Method Description
Equal Allocation Every process receives the same number of frames.
Proportional Allocation Frames are allocated according to process size.
Priority Allocation Processes with higher priority receive more frames.
Total Frames ↓ Operating System ↓ Allocate Frames ↓ Process P1 Process P2 Process P3

5. Page Replacement Algorithms

When all frames are occupied and a new page is required, the operating system must remove one existing page. The technique used to decide which page should be removed is called a Page Replacement Algorithm.

★★★★★ This topic is one of the most important numerical topics in RGPV examinations.

Types of Page Replacement Algorithms

FIFO
Optimal
LRU

6. FIFO (First In First Out)

FIFO replaces the page that entered memory first. The oldest page is removed regardless of how frequently it is being used.

Working

Pages Enter ↓ Oldest Page ↓ Replace Oldest ↓ Load New Page

Advantages

  • Easy to implement.
  • Requires less overhead.
  • Simple queue implementation.

Disadvantages

  • May remove frequently used pages.
  • Can produce Belady's Anomaly.
Example Numerical: Reference String: 7 0 1 2 0 3 0 4 Practice this for exam.

7. Optimal Page Replacement

Optimal Page Replacement removes the page that will not be used for the longest period in the future. Although it provides minimum page faults, future references are unknown in real systems.

Future Reference ↓ Find Longest Unused Page ↓ Replace It

Advantages

  • Minimum page faults.
  • Best theoretical algorithm.
  • Used for comparison.

Disadvantages

  • Future page references are unknown.
  • Cannot be implemented practically.
Optimal algorithm is generally asked for comparison with FIFO and LRU.

8. LRU (Least Recently Used)

LRU replaces the page that has not been used for the longest time in the past. It assumes recently used pages are more likely to be used again.

Track Recent Usage ↓ Least Recently Used Page ↓ Replace It

Advantages

  • Better than FIFO.
  • Closer to Optimal.
  • Lower page faults.

Disadvantages

  • Implementation is difficult.
  • Requires additional hardware or counters.

9. Comparison of FIFO, Optimal and LRU

Feature FIFO Optimal LRU
Implementation Easy Impossible Practically Moderate
Page Faults High Minimum Low
Performance Average Best Very Good
Exam Importance ★★★★★ ★★★★★ ★★★★★

10. Thrashing

Thrashing is a situation where the operating system spends more time swapping pages than executing processes. This happens when too many page faults occur because processes do not have sufficient frames.

Few Frames ↓ Many Page Faults ↓ Continuous Swapping ↓ CPU Idle ↓ Thrashing

Causes of Thrashing

  • Insufficient physical memory.
  • Too many processes.
  • Improper frame allocation.
  • High page fault rate.

Effects of Thrashing

  • Very slow system.
  • Low CPU utilization.
  • Poor performance.
  • Reduced throughput.

How to Prevent Thrashing

  • Increase RAM.
  • Reduce degree of multiprogramming.
  • Use working set model.
  • Allocate sufficient frames.
★★★★★ Thrashing is one of the favorite 5-mark and 7-mark questions in RGPV.

11. Demand Segmentation

Demand Segmentation is similar to demand paging, but instead of pages, complete segments are loaded into memory only when required. It improves memory utilization by loading only useful program segments.

Working

Program Starts
Segment Requested
Segment Present?
No
Load Segment
Continue Execution

Advantages

  • Better logical organization.
  • Improves memory utilization.
  • Supports modular programming.
  • Only required segments are loaded.

Disadvantages

  • More complex than paging.
  • May cause external fragmentation.
Important Difference: Demand Paging loads pages. Demand Segmentation loads segments.

12. Role of Operating System in Security

An Operating System is responsible for protecting the entire computer system from unauthorized access, malware attacks, accidental damage, and misuse of system resources. It acts as the first layer of security between users and hardware resources.

Definition:
Operating System Security refers to the collection of techniques and mechanisms used by an operating system to protect hardware, software, files, memory and users from unauthorized access and cyber threats.

Objectives of Operating System Security

  • Protect user information.
  • Prevent unauthorized access.
  • Maintain data confidentiality.
  • Ensure system availability.
  • Maintain data integrity.
  • Protect hardware resources.
  • Secure network communication.

Major Responsibilities of Operating System

User Authentication
Access Control
File Protection
Memory Protection
Process Protection
Network Security
Audit Logs
User ↓ Login Authentication ↓ Operating System ↓ Permission Checking ↓ Access Granted / Denied ↓ System Resources

Advantages

  • Protects confidential data.
  • Reduces cyber attacks.
  • Improves system reliability.
  • Maintains secure communication.
  • Provides safe execution environment.

13. Security Breaches

A security breach occurs when an unauthorized person, malicious software or attacker gains access to confidential information, system resources or network services without proper permission.

Security Breach means any activity that violates the security policy of a computer system.

Common Types of Security Breaches

Threat Description Example
Virus Malicious program that infects files. USB Virus
Worm Self-replicating malware. Network Worm
Trojan Horse Fake software hiding malicious code. Fake Application
Spyware Steals user information secretly. Password Stealer
Ransomware Encrypts files and demands payment. WannaCry
Phishing Fake emails or websites used to steal passwords. Bank Login Scam
DoS Attack Denial of Service attack. Website Crash

Causes of Security Breaches

  • Weak passwords.
  • Outdated operating system.
  • Unpatched software.
  • Unsafe internet browsing.
  • Malware infection.
  • Human error.

How to Prevent Security Breaches?

  • Install antivirus software.
  • Use firewall.
  • Update operating system regularly.
  • Use strong passwords.
  • Enable two-factor authentication.
  • Backup important data.
Weak Password ↓ Unauthorized Login ↓ Security Breach ↓ Data Theft ↓ System Damage

14. System Protection

System Protection refers to the mechanisms used by the operating system to control access to hardware resources, memory, files and devices. Its objective is to ensure that only authorized users and processes can access protected resources.

System Protection controls resource access while Security protects the complete system.

Types of Protection

Protection Type Purpose
CPU Protection Protect processor from misuse.
Memory Protection Prevent illegal memory access.
File Protection Protect files from unauthorized users.
I/O Protection Control access to hardware devices.
Network Protection Secure communication channels.

Protection Mechanisms

  • User ID (UID)
  • Access Control List (ACL)
  • Permission Bits
  • Access Matrix
  • Protection Domains
User ↓ Authentication ↓ Authorization ↓ Permission Check ↓ Resource Access

15. Password Management

Password Management is the process of creating, storing, protecting and updating user passwords securely. It is one of the simplest and most effective methods of securing an operating system.

Strong password policies are frequently asked as short notes in university examinations.

Characteristics of a Strong Password

  • Minimum 8–12 characters.
  • Uppercase and lowercase letters.
  • Numbers.
  • Special symbols.
  • No personal information.
  • Unique for every account.

Good Password Practices

Create Strong Password
Store Securely
Use Password Manager
Enable 2FA
Change Regularly

Password Storage Techniques

Technique Description
Plain Text Not secure.
Encryption Password is encrypted before storage.
Hashing One-way conversion used in modern systems.
Salted Hash Additional random value improves security.

Advantages of Password Management

  • Protects user accounts.
  • Prevents unauthorized access.
  • Improves system security.
  • Reduces identity theft.
  • Supports secure authentication.
★★★★★ Exam Tip Remember the difference between: • Authentication → Verifies identity. • Authorization → Gives permission. • Protection → Controls access. • Security → Protects the entire system.

📊 Unit 4 PYQ Analysis

Based on the analysis of previous RGPV IT501 Operating System question papers, the following topics have the highest probability of appearing in the examination.

Topic Frequency Importance Expected Marks
Virtual Memory ★★★★★ Very High 7–14 Marks
Demand Paging ★★★★★ Very High 5–14 Marks
FIFO / LRU / Optimal ★★★★★ Very High Numerical
Thrashing ★★★★☆ High 5 Marks
OS Security ★★★★☆ High 5–7 Marks
Password Management ★★★☆☆ Medium 2–5 Marks
🔥 Most Expected Long Question: Explain Virtual Memory with Demand Paging and Page Replacement Algorithms.

⭐ Top Important Questions

  1. Explain Virtual Memory with neat diagram.
  2. Explain Demand Paging and Page Fault.
  3. Explain FIFO Page Replacement Algorithm.
  4. Explain LRU Page Replacement Algorithm.
  5. Explain Optimal Page Replacement Algorithm.
  6. Compare FIFO, LRU and Optimal Algorithms.
  7. Explain Thrashing and its prevention.
  8. Explain Allocation of Frames.
  9. Explain Cache Memory Organization.
  10. Explain Demand Segmentation.
  11. Explain Operating System Security.
  12. Explain Security Breaches.
  13. Explain System Protection.
  14. Write short note on Password Management.
  15. Differentiate Authentication and Authorization.

🎤 Viva Questions

  • What is Virtual Memory?
  • What is a Page Fault?
  • What is Thrashing?
  • Which Page Replacement Algorithm is best?
  • What is Cache Memory?
  • Difference between Paging and Segmentation?
  • What is Password Hashing?
  • What is Authentication?
  • What is Authorization?
  • What is System Protection?

⚡ One Page Quick Revision

Topic Remember
Virtual Memory Uses secondary storage as RAM extension.
Demand Paging Loads page only when required.
Page Fault Occurs when required page is absent.
FIFO Oldest page replaced.
Optimal Future unused page replaced.
LRU Least Recently Used page replaced.
Thrashing Too many page faults.
Security Protects entire computer system.
Protection Controls access to resources.

❓ Frequently Asked Questions

Is Unit 4 important for RGPV?

Yes. Unit 4 is one of the highest scoring units because it contains theory as well as numerical questions.

Which Page Replacement Algorithm should I prepare?

Prepare FIFO, LRU and Optimal thoroughly with numerical examples.

Can numerical questions come from Unit 4?

Yes. FIFO, LRU, Optimal and Page Fault calculations are frequently asked.

Which topic has highest probability?

Virtual Memory and Demand Paging have the highest probability.

📚 Related Operating System Units