Computer Memory Management is an important topic under Operating System and Computer Organization. For Bihar STET and BPSC Computer Science exams, questions can be asked from paging, segmentation, virtual memory, page replacement, fragmentation, memory allocation and thrashing.
1. What is Memory Management?
Memory Management is the function of an Operating System that manages the allocation, utilization and deallocation of main memory among different processes.
Major functions
Allocation of memory
Deallocation of memory
Memory protection
Address translation
Sharing of memory
Virtual memory management
Handling fragmentation
Swapping
Paging and segmentation
Exam Point
Memory Management → Allocation + Deallocation + Protection + Address Translation
2. Types of Computer Memory
Computer memory can broadly be classified as:
Primary Memory
RAM
ROM
Cache
Secondary Memory
HDD
SSD
Optical Disk
Magnetic Tape
For Operating System memory management, the most important concepts are:
RAM → Virtual Memory → Paging → Segmentation → Page Replacement
3. Address Binding
Address binding means associating program instructions and data with actual memory addresses.
There are three major types:
1. Compile-Time Binding
If the starting memory location is known at compile time, the compiler generates absolute addresses.
2. Load-Time Binding
If the memory location is not known at compile time, the compiler generates relocatable code. Address binding occurs when the program is loaded.
3. Execution-Time Binding
Address binding can be performed while the program is executing.
It requires hardware support such as the MMU.
Important
Compile Time → Before loading
Load Time → During loading
Execution Time → During execution
4. Logical Address
The address generated by the CPU is called the:
Logical Address
It is also called a virtual address in virtual-memory systems.
Example:
CPU generates:
Logical Address = 2500
This address is translated into an actual physical memory address.
5. Physical Address
The actual address in the main memory (RAM) is called:
Physical Address
The Memory Management Unit (MMU) performs address translation.
Address Translation
CPU → Logical Address → MMU → Physical Address → Main Memory
Important MCQ
Which hardware converts logical address into physical address?
Answer:
MMU – Memory Management Unit
6. Memory Management Unit – MMU
The MMU is a hardware component responsible for memory address translation.
Main functions:
Logical-to-physical address conversion
Memory protection
Support for paging
Support for segmentation
Virtual memory support
7. Contiguous Memory Allocation
In contiguous allocation, each process occupies a single continuous block of memory.
Two major methods are:
Fixed Partitioning
Variable/Dynamic Partitioning
8. Fixed Partitioning
In fixed partitioning, main memory is divided into a fixed number of partitions.
Each partition can hold one process.
Advantages
Simple implementation
Easy memory allocation
Low management overhead
Disadvantage
Internal Fragmentation
Example:
Partition = 100 KB
Process = 70 KB
Unused = 30 KB
This unused space inside the allocated partition is internal fragmentation.
9. Variable Partitioning
In variable partitioning, partitions are created dynamically according to process requirements.
Example:
Process A = 100 KB
Process B = 200 KB
Process C = 150 KB
Memory is allocated according to actual requirements.
Advantage
Less internal fragmentation.
Disadvantage
Can produce:
External Fragmentation
10. Internal Fragmentation
Internal fragmentation occurs when allocated memory contains unused space inside the allocated block.
Example:
Required = 18 KB
Allocated = 20 KB
Unused = 2 KB
Therefore:
Internal Fragmentation = 2 KB
Shortcut
Internal → Inside allocated block
11. External Fragmentation
External fragmentation occurs when free memory is available but divided into several small, non-contiguous blocks.
Example:
Free blocks:
10 KB + 20 KB + 15 KB + 25 KB
Total free memory = 70 KB
But a process requiring 50 KB of contiguous memory may not be allocated if no individual block is large enough.
Shortcut
External → Outside allocated blocks
12. Memory Allocation Strategies
Three important memory allocation techniques are:
First Fit
The first available block large enough to satisfy the request is selected.
First Fit → First suitable block
Best Fit
The smallest available block that is large enough is selected.
Best Fit → Smallest suitable block
Worst Fit
The largest available block is selected.
Worst Fit → Largest available block
Quick Table
| Strategy | Selects |
|---|---|
| First Fit | First suitable block |
| Best Fit | Smallest suitable block |
| Worst Fit | Largest suitable block |
13. Paging
Paging is one of the most important topics for Bihar STET and BPSC.
Paging divides:
Logical Memory → Pages
Physical Memory → Frames
Both pages and frames are of equal fixed size.
Example:
Page size = 4 KB
Physical memory is also divided into 4 KB frames.
A page can be placed into any available frame.
14. Page
A page is a fixed-size block of logical/virtual memory.
Example:
If logical memory = 16 KB
and page size = 4 KB:
Number of pages:
16 / 4 = 4 pages
15. Frame
A frame is a fixed-size block of physical memory.
Most Important
Page → Logical Memory
Frame → Physical Memory
16. Page Table
A page table maintains the mapping between pages and frames.
Example:
| Page Number | Frame Number |
|---|---|
| 0 | 5 |
| 1 | 2 |
| 2 | 7 |
| 3 | 1 |
The OS/MMU uses this mapping for address translation.
Remember
Page Table → Page-to-Frame Mapping
17. Paging Address Structure
A logical address in paging is divided into:
Page Number + Offset
The page number is used to locate the corresponding frame.
The offset identifies the exact location inside that frame.
Formula
If page size = <math>
Offset bits = n
18. Paging and Fragmentation
Paging eliminates:
External Fragmentation
because pages can be placed in any available frames.
However, paging can cause:
Internal Fragmentation
particularly in the last allocated page/frame.
Exam Question
Which fragmentation is associated with paging?
Answer:
Internal fragmentation
19. Segmentation
Segmentation divides a program according to its logical structure.
For example:
Code segment
Data segment
Stack segment
Function segment
Procedure segment
Unlike paging, segments are:
Variable in size.
20. Segment Table
Segmentation uses a segment table.
Each segment entry generally contains:
Base address
Limit
Base
Starting physical address of the segment.
Limit
Size/length of the segment.
21. Paging vs Segmentation
| Paging | Segmentation |
|---|---|
| Fixed-size blocks | Variable-size blocks |
| Pages | Segments |
| Physical memory uses frames | Logical program structure |
| Page table | Segment table |
| Can cause internal fragmentation | Can cause external fragmentation |
| Programmer usually doesn't see pages | Segments correspond to logical program units |
Memory Trick
Paging = Fixed
Segmentation = Variable
22. Virtual Memory
Virtual memory is a memory-management technique that allows programs to execute even when the complete program cannot fit into physical RAM.
It uses secondary storage as an extension of physical memory.
Main Idea
Virtual Memory = RAM + Secondary Storage Support
It allows a process to have a larger logical address space than available physical memory.
23. Demand Paging
In demand paging, a page is loaded into RAM only when it is required.
If the required page is not present in RAM:
Page Fault occurs.
24. Page Fault
A page fault occurs when a process references a page that is not currently present in physical memory.
Page Fault Steps
CPU generates an address.
Page table is checked.
Required page is not found in RAM.
Page fault occurs.
OS locates the page on secondary storage.
A free frame is found.
Page is loaded into the frame.
Page table is updated.
Instruction is restarted.
Important
Page Fault does NOT mean the program is necessarily invalid.
It means the required page is currently absent from physical memory.
25. Page Replacement
If a page fault occurs and no free frame is available, the OS must remove an existing page.
This is called:
Page Replacement
Important algorithms:
FIFO
Optimal
LRU
26. FIFO Page Replacement
FIFO stands for:
First-In, First-Out
The page that entered memory first is removed first.
Advantage
Simple
Easy to implement
Disadvantage
May remove an important frequently used page.
FIFO can suffer from:
Belady's Anomaly
27. Belady's Anomaly
Belady's anomaly occurs when increasing the number of available page frames results in an increase in page faults.
It is famously associated with:
FIFO
Exam Fact
Belady's Anomaly → FIFO
28. Optimal Page Replacement
The Optimal algorithm replaces the page that will not be used for the longest period in the future.
It produces the minimum possible number of page faults for a given reference string.
Problem
The future memory references are generally unknown.
Therefore, it is mainly used as a benchmark rather than a practical general-purpose algorithm.
Shortcut
Optimal → Farthest future use
29. LRU Page Replacement
LRU stands for:
Least Recently Used
It replaces the page that has not been used for the longest period in the past.
Shortcut
LRU → Least Recently Used
LRU generally performs better than simple FIFO for many workloads.
30. FIFO vs LRU vs Optimal
| Algorithm | Replacement Rule |
|---|---|
| FIFO | Oldest page |
| LRU | Least recently used |
| Optimal | Farthest future use |
31. Thrashing
Thrashing occurs when the system spends most of its time handling page faults and moving pages between RAM and secondary storage rather than executing useful instructions.
Causes
Insufficient memory
Too many processes
Excessive page faults
Poor allocation of frames
Effect
CPU utilization and overall performance decrease.
Important
Thrashing → Excessive paging
32. Swapping
Swapping involves temporarily moving a process between:
Main Memory ↔ Secondary Storage
Swap Out
Process is moved from RAM to secondary storage.
Swap In
Process is brought back into RAM.
33. Overlays
An overlay technique allows only the required portion of a program to be loaded into memory.
It was particularly useful when physical memory was too small to contain the entire program.
Important
Overlay is an older technique for managing limited memory.
34. Relocation
Relocation refers to modifying address references so that a program can execute from a different memory location.
It is important when programs are loaded into memory at locations different from those assumed during compilation.
35. Dynamic Loading
In dynamic loading, a routine is loaded into memory only when it is actually called.
Advantage
It saves memory because unused routines do not need to remain in memory.
36. Dynamic Linking
Dynamic linking postpones linking of some libraries until execution time.
Shared libraries can be loaded when required.
Difference
Dynamic Loading → Loading routines
Dynamic Linking → Linking libraries/modules
37. TLB – Translation Lookaside Buffer
TLB is a small, high-speed memory/cache that stores recently used page-table entries.
Its purpose is to speed up virtual-to-physical address translation.
TLB Hit
Required page-table entry is found in TLB.
TLB Miss
Required entry is not found in TLB.
Shortcut
TLB → Fast address translation
38. Memory Protection
Memory protection prevents one process from accessing another process's memory without authorization.
It provides:
Security
Process isolation
Data protection
System stability
39. Important Formulas
Number of Pages
Number of Pages = Logical Address Space / Page Size
Number of Frames
Number of Frames = Physical Memory Size / Frame Size
Since page size = frame size:
Page Size = Frame Size
40. High-Priority Topics for Bihar STET & BPSC
For examination preparation, give special attention to:
Very High Priority
Paging
Page Table
Page Fault
Page Replacement Algorithms
FIFO
LRU
Optimal Page Replacement
Belady's Anomaly
Virtual Memory
Thrashing
High Priority
Internal & External Fragmentation
Segmentation
First Fit
Best Fit
Worst Fit
Logical & Physical Address
MMU
TLB
Swapping
Fixed & Variable Partitioning
Conceptual Questions
Address Binding
Relocation
Dynamic Loading
Dynamic Linking
Overlays
Top 50 MCQs – Bihar STET & BPSC Focus
1. Which component converts a logical address into a physical address?
A. ALU
B. CU
C. MMU
D. Register
Answer: C. MMU
2. In paging, logical memory is divided into:
A. Frames
B. Pages
C. Segments
D. Blocks only
Answer: B. Pages
3. Physical memory is divided into:
A. Pages
B. Segments
C. Frames
D. Files
Answer: C. Frames
4. Pages and frames are generally:
A. Variable-sized
B. Fixed-sized
C. Random-sized
D. Always unequal
Answer: B. Fixed-sized
5. Which table maps pages to frames?
A. Segment table
B. Page table
C. File table
D. Process table
Answer: B. Page table
6. Which fragmentation is associated with paging?
A. External
B. Internal
C. Logical
D. Dynamic
Answer: B. Internal
7. Which fragmentation is commonly associated with variable partitioning?
A. Internal
B. External
C. Cache
D. Page
Answer: B. External
8. Which allocation strategy chooses the first suitable memory block?
A. Best Fit
B. Worst Fit
C. First Fit
D. Next Fit
Answer: C. First Fit
9. Best Fit selects:
A. Largest block
B. Smallest suitable block
C. First block
D. Random block
Answer: B. Smallest suitable block
10. Worst Fit selects:
A. Smallest block
B. First block
C. Largest suitable block
D. Random block
Answer: C. Largest suitable block
11. Which technique allows execution of programs larger than available physical memory?
A. Spooling
B. Virtual memory
C. Buffering
D. Caching
Answer: B. Virtual memory
12. A page fault occurs when:
A. Page is corrupted
B. Page is not present in physical memory
C. Page is too large
D. CPU stops
Answer: B. Page is not present in physical memory
13. Which algorithm replaces the oldest page?
A. LRU
B. FIFO
C. Optimal
D. MRU
Answer: B. FIFO
14. LRU stands for:
A. Last Recently Used
B. Least Recently Used
C. Least Required Unit
D. Last Required Used
Answer: B. Least Recently Used
15. Which algorithm replaces the page that will be used farthest in the future?
A. FIFO
B. LRU
C. Optimal
D. Round Robin
Answer: C. Optimal
16. Belady's anomaly is associated with:
A. LRU
B. FIFO
C. Optimal
D. Best Fit
Answer: B. FIFO
17. Which page replacement algorithm gives the theoretical minimum number of page faults?
A. FIFO
B. LRU
C. Optimal
D. Random
Answer: C. Optimal
18. Thrashing occurs because of:
A. Excessive page faults
B. Excessive CPU speed
C. Large cache
D. High ROM capacity
Answer: A. Excessive page faults
19. Segmentation divides a program into:
A. Fixed-size pages
B. Logical variable-sized segments
C. Equal frames
D. Fixed partitions only
Answer: B. Logical variable-sized segments
20. Which technique uses a segment table?
A. Paging
B. Segmentation
C. Swapping
D. Caching
Answer: B. Segmentation
21. Which technique uses a page table?
A. Segmentation
B. Paging
C. Swapping
D. Linking
Answer: B. Paging
22. The address generated by the CPU is generally called:
A. Physical address
B. Logical address
C. Absolute address only
D. Disk address
Answer: B. Logical address
23. The actual location in RAM is called:
A. Logical address
B. Virtual address
C. Physical address
D. Relative address
Answer: C. Physical address
24. TLB is used to:
A. Increase disk capacity
B. Speed up address translation
C. Store files permanently
D. Execute programs
Answer: B. Speed up address translation
25. TLB stores:
A. Complete programs
B. Recent page-table entries
C. Files
D. CPU instructions only
Answer: B. Recent page-table entries
26. Which memory management technique can eliminate external fragmentation?
A. Paging
B. Variable partitioning
C. Segmentation
D. Swapping
Answer: A. Paging
27. Which technique can suffer from external fragmentation?
A. Paging
B. Segmentation
C. Fixed-size paging
D. Cache mapping
Answer: B. Segmentation
28. Swap Out means:
A. Bringing a process into RAM
B. Moving a process from RAM to secondary storage
C. Deleting a process
D. Copying a file
Answer: B. Moving a process from RAM to secondary storage
29. Swap In means:
A. Moving a process into RAM
B. Deleting a process
C. Formatting RAM
D. Moving a file to disk
Answer: A. Moving a process into RAM
30. Which memory management technique uses secondary storage as an extension of RAM?
A. Virtual memory
B. Cache memory
C. ROM
D. Register memory
Answer: A. Virtual memory
31. In fixed partitioning, the major problem is:
A. External fragmentation only
B. Internal fragmentation
C. Page fault
D. Deadlock
Answer: B. Internal fragmentation
32. In variable partitioning, the major problem can be:
A. External fragmentation
B. Cache miss
C. Register overflow
D. Instruction error
Answer: A. External fragmentation
33. Which algorithm is simplest to implement among common page replacement algorithms?
A. FIFO
B. Optimal
C. LRU
D. Working Set
Answer: A. FIFO
34. Which algorithm requires knowledge of future page references?
A. FIFO
B. LRU
C. Optimal
D. First Fit
Answer: C. Optimal
35. Which algorithm uses past page-reference information?
A. LRU
B. Optimal
C. FIFO only
D. Worst Fit
Answer: A. LRU
36. A logical address in paging is divided into:
A. Segment + Limit
B. Page Number + Offset
C. Frame + Segment
D. Base + Limit
Answer: B. Page Number + Offset
37. A segment table entry commonly contains:
A. Page number and frame number
B. Base and limit
C. File name and size
D. CPU and RAM speed
Answer: B. Base and limit
38. The size of a page is generally:
A. Variable
B. Fixed
C. Determined for each process randomly
D. Always 1 KB
Answer: B. Fixed
39. The size of a segment is generally:
A. Fixed
B. Variable
C. Always 4 KB
D. Always 8 KB
Answer: B. Variable
40. Which technique loads a routine only when it is called?
A. Dynamic loading
B. Static loading
C. Paging
D. Swapping
Answer: A. Dynamic loading
41. Relocation is related to:
A. Changing program addresses to suit memory location
B. Deleting files
C. CPU scheduling
D. Disk formatting
Answer: A. Changing program addresses to suit memory location
42. Which binding occurs during program execution?
A. Compile-time binding
B. Load-time binding
C. Execution-time binding
D. Static binding
Answer: C. Execution-time binding
43. Which hardware support is required for execution-time address binding?
A. ALU
B. MMU
C. Printer
D. Keyboard
Answer: B. MMU
44. Which of the following is NOT a page replacement algorithm?
A. FIFO
B. LRU
C. Optimal
D. First Fit
Answer: D. First Fit
45. First Fit, Best Fit and Worst Fit are primarily:
A. CPU scheduling algorithms
B. Memory allocation strategies
C. Page replacement algorithms
D. Disk scheduling algorithms
Answer: B. Memory allocation strategies
46. Excessive movement of pages between RAM and disk is associated with:
A. Thrashing
B. Deadlock
C. Fragmentation
D. Spooling
Answer: A. Thrashing
47. Which one is correctly matched?
A. Page – Physical memory
B. Frame – Logical memory
C. Page – Logical memory
D. Segment – Fixed-size block
Answer: C. Page – Logical memory
48. Which one is correctly matched?
A. FIFO – Least recently used
B. LRU – Oldest page
C. Optimal – Longest future use
D. Best Fit – Largest block
Answer: C. Optimal – Longest future use
49. Which technique is most directly associated with fixed-size blocks?
A. Segmentation
B. Paging
C. Dynamic partitioning
D. Variable partitioning
Answer: B. Paging
50. Which statement is correct?
A. Paging uses variable-sized pages
B. Segmentation uses fixed-size segments
C. Paging uses pages and frames
D. FIFO never suffers from Belady's anomaly
Answer: C. Paging uses pages and frames
Final Revision – 15 Seconds
MMU → Logical → Physical
Paging → Page + Frame
Page → Logical Memory
Frame → Physical Memory
Paging → Fixed Size
Segmentation → Variable Size
Paging → Internal Fragmentation
Segmentation → External Fragmentation
FIFO → Oldest Page
LRU → Least Recently Used
Optimal → Farthest Future Use
FIFO → Belady's Anomaly
Page Fault → Page absent from RAM
Thrashing → Excessive Page Faults
TLB → Fast Address Translation
First Fit → First Suitable Block
Best Fit → Smallest Suitable Block
Worst Fit → Largest Suitable Block
Virtual Memory → Secondary Storage + RAM concept
For Bihar STET, Operating System topics including memory management, virtual memory, paging, segmentation, swapping and thrashing are directly relevant; the broader BPSC Computer Science syllabus likewise places memory management and virtual memory under Operating Systems.