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

Memory Management in Operating Systems

notes

Uploaded by

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

Memory Management in Operating Systems

notes

Uploaded by

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

Memory Management in Operating Systems

Memory management is a crucial function of an operating system, responsible for allocating


and deallocating memory to processes. It aims to optimize resource utilization and prevent
conflicts between processes.

Memory Management Techniques

1. Contiguous Allocation:
o Simple allocation: Memory is divided into contiguous blocks, and each
process is allocated a single block.
o Fragmentation: Can lead to internal fragmentation (unused space within a
process's block) and external fragmentation (unused space between processes).
o Suitable for: Batch systems where processes are known in advance.
2. Paging:
o Memory is divided into fixed-size pages: Both physical and logical memory
are divided into pages.
o Page table: A table maps virtual addresses to physical addresses.
o Advantages: Efficient memory utilization, reduces fragmentation.
o Disadvantages: Requires additional memory for the page table.
3. Segmentation:
o Memory is divided into variable-size segments: Each segment corresponds
to a logical unit (e.g., code, data, stack).
o Segment table: Maps logical segments to physical addresses.
o Advantages: Better memory protection, efficient for programs with distinct
memory requirements.
o Disadvantages: Can lead to internal fragmentation.
4. Paged Segmentation:
o Combines paging and segmentation for a more flexible approach.
o Segments are further divided into pages.

Memory Allocation Algorithms

 First-Fit: Allocates the first available memory block that is large enough.
 Best-Fit: Allocates the smallest available memory block that is large enough.
 Worst-Fit: Allocates the largest available memory block.
 Buddy System: Divides memory into blocks of equal size and allocates them in a
hierarchical manner.

Memory Protection

 Hardware support: Memory Management Unit (MMU) ensures that processes


cannot access memory outside their allocated space.
 Base/bounds registers: Define the memory address range for a process.
 Page tables/segment tables: Control access to memory pages or segments.

Virtual Memory
 Illusion of more memory: Allows processes to use more memory than physically
available.
 Demand paging: Pages are loaded into physical memory only when needed.
 Page replacement algorithms: Determine which page to replace when a new page
needs to be loaded. (e.g., FIFO, LRU, Optimal)

Additional Topics

 Memory compaction: Rearranging memory to reduce fragmentation.


 Swapping: Moving processes between main memory and secondary storage.
 Memory-mapped files: Mapping files directly into the process's address space.
 Shared memory: Allowing multiple processes to share a region of memory.

Remember to explore these topics in more depth and practice implementing concepts
using programming languages like C or C++.

You might also like