Paging क्या है?
Paging एक memory management technique है जिसमें process और memory दोनों को fixed size blocks में divide किया जाता है।
- Process को divide किया जाता है → Pages में
- Memory को divide किया जाता है → Frames में
हर page को किसी भी frame में रखा जा सकता है, जरूरी नहीं कि वो continuous हो।
Basic Concept
- Page Size = Frame Size
- Page Table mapping करता है कि कौन-सा page किस frame में है
Address Structure
Logical Address दो भागों में होता है:
- Page Number (p)
- Offset (d)
Physical Address:
- Frame Number + Offset
Address Translation
CPU Logical Address देता है:
(p, d)
Step:
- Page Table में page number खोजा जाता है
- उससे frame number मिलता है
- Frame number + offset = Physical Address
Formula (Important)
Physical Address = (Frame Number × Frame Size) + Offset
Example (Numerical)
Question:
Page Size = 100 bytes
Page Table:
| Page | Frame |
|---|---|
| 0 | 5 |
| 1 | 2 |
| 2 | 8 |
| 3 | 1 |
Logical Address = 250
Solution
Step 1: Page Number और Offset निकालो
Page Number = 250 / 100 = 2
Offset = 250 % 100 = 50
Step 2: Page Table से Frame Number निकालो
Page 2 → Frame 8
Step 3: Physical Address निकालो
Physical Address = (8 × 100) + 50
= 800 + 50
= 850
Final Answer: Physical Address = 850
Advantages of Paging
- External Fragmentation खत्म हो जाती है
- Memory utilization अच्छा होता है
- Process को कहीं भी load किया जा सकता है
Disadvantages of Paging
- Internal Fragmentation हो सकती है
- Page Table की जरूरत होती है
- Extra memory overhead होता है
Short Conclusion
Paging एक non-contiguous memory allocation technique है जिसमें process को pages और memory को frames में divide किया जाता है। Page Table की मदद से page को frame से map किया जाता है। इससे external fragmentation खत्म हो जाती है, लेकिन internal fragmentation हो सकती है।