0% found this document useful (0 votes)
13 views5 pages

Untitled Document

This case study discusses memory management in operating systems, highlighting its importance in allocating and tracking memory for multiple processes. It covers types of memory, allocation techniques, and compares memory management in Windows and Linux. The study emphasizes the significance of concepts like paging and virtual memory for efficient system performance.

Uploaded by

Amit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Untitled Document

This case study discusses memory management in operating systems, highlighting its importance in allocating and tracking memory for multiple processes. It covers types of memory, allocation techniques, and compares memory management in Windows and Linux. The study emphasizes the significance of concepts like paging and virtual memory for efficient system performance.

Uploaded by

Amit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Case Study on Memory Management

Name: HARSH RAI​


Roll No: 202310101150239​
Semester: 4th​
Branch: CS(DS+AI)​
Subject: OPERATING SYSTEM

Introduction to Memory Management

Memory management is one of the most essential functions of an operating system. It deals
with the management of the computer’s physical memory (RAM). When multiple programs run
on a system, they all need memory to work, and the operating system ensures that each one
gets the required memory without interfering with others.

Why is it important?

●​ It keeps track of each byte in a computer's memory.​

●​ Allocates memory to processes when they need it and frees it when not in use.​

●​ Prevents one process from accessing the memory of another process.​

Real-life example:​
Imagine your memory as a desk. If you’re working on three different subjects (math, physics,
and programming), you need to place their books on the desk. Memory management is like
arranging these books properly so they don’t mix up and each has space.

Types of Memory

Memory in a computer system can be divided into various types:

1.​ Primary Memory:​

RAM (Random Access Memory): Temporary and volatile memory. It holds the data and
programs currently in use.

ROM (Read Only Memory): Permanent memory used to store the system’s firmware.​

2.​ Secondary Memory:


Hard drives and SSDs are non-volatile storage, used for storing data permanently.​

3.​ Cache Memory:


High-speed memory placed between CPU and RAM. It stores frequently used data to
speed up access.​

4.​ Virtual Memory:


A portion of the hard drive used as if it were RAM. It allows more programs to run than
physical memory can support.​

Example:


If your computer has 4GB RAM and you run many programs, it uses part of your hard drive as
temporary RAM. That’s virtual memory.

Memory Allocation Techniques

Memory must be allocated to processes efficiently. There are two main types:

Contiguous Memory Allocation:

●​ The process is given one continuous block of memory.​

●​ Fixed Partitioning: Memory is divided into fixed sizes. Small programs waste memory
(internal fragmentation).​

●​ Variable Partitioning: Allocates memory as per process size, which may cause memory
holes (external fragmentation).​
Non-Contiguous Memory Allocation:

●​ Paging: Memory is divided into equal-sized blocks (pages). These pages can be loaded
anywhere in RAM.​

●​ Segmentation: Divides programs into segments (like code, stack, data). More logical for
programmer use.​

Diagram idea (for your notes):

●​ Show RAM divided into pages and segments with process parts spread across.​

Paging – A Detailed Look

Paging is the most commonly used memory management technique in modern systems.

How it works:

●​ The process is split into pages.​

●​ RAM is divided into frames (same size as pages).​

●​ A page table maps pages to frames.​

●​ The CPU generates a logical address which is converted to a physical address using the
page table.​

Advantages:

●​ Avoids external fragmentation.​

●​ Efficient memory use.​

Disadvantages:

●​ Can be slower due to address translation.​

●​ Page tables require memory themselves.​


Example:​
If a program needs 12KB and the page size is 4KB, it will need 3 pages. These can be stored in
different parts of RAM.

Virtual Memory

Virtual memory gives the illusion of a very large memory even if physical RAM is limited.

How it works:

●​ Stores parts of the process on the hard disk when RAM is full.​

●​ Uses demand paging to bring in pages only when needed.​

●​ If a needed page isn’t in memory, it causes a page fault. The OS then loads that page
from disk.​

Thrashing:​
When the system spends more time swapping pages in and out of memory than executing the
actual process.

Example:​
Running heavy applications like Photoshop, Chrome, and MS Word together on a 4GB RAM
system—OS uses hard disk as extra memory.

Memory Management in Windows vs Linux

Both operating systems manage memory differently:

Windows:

●​ Uses virtual memory and a file called pagefile.sys.​

●​ Memory is divided into working sets for each process.​

●​ Built-in Task Manager shows memory usage.​

Linux:
●​ Uses virtual memory with a swap partition.​

●​ Commands like top, free, and vmstat show real-time memory stats.​

●​ More control over memory through terminal.​

Comparison Table:

Feature Windows Linux

Swap File pagefile.sys swap partition/file

Monitoring Tool Task Manager top, free, htop

Customization Limited Highly customizable

Conclusion and References

Conclusion:

Memory management is crucial for efficient functioning of an operating system. It allows multiple
processes to run simultaneously without conflicts. With concepts like paging and virtual memory,
systems can run more applications than the physical memory alone would allow. Understanding
how different OSes handle memory helps in optimizing applications and troubleshooting
performance issues.

References:

●​ Silberschatz, Galvin, Gagne – Operating System Concepts​

●​ GeeksforGeeks – https://www.geeksforgeeks.org/​

●​ TutorialsPoint – https://www.tutorialspoint.com/​

●​ Linux Handbook – https://linuxhandbook.com/​

You might also like