Chapter 3 (Hindi)
3. Paging and Segmentation
Paging vs. Segmentation
Paging vs Segmentation (पेजिंग और सेगमेंटेशन)
Paging और Segmentation दोनों ही memory management techniques हैं, लेकिन दोनों का तरीका अलग होता है:
- Paging → memory को fixed-size pages में divide करता है
- Segmentation → memory को logical units (जैसे functions, arrays, data) के हिसाब से variable-size segments में divide करता है
👉 Modern systems में अक्सर दोनों techniques को combine करके use किया जाता है
Paging (पेजिंग)
Definition (परिभाषा):
Paging एक technique है जो non-contiguous memory allocation के लिए use होती है। इसमें memory को fixed-size blocks में divide किया जाता है।
- Secondary memory के blocks → pages
- Main memory (RAM) के blocks → frames
👉 हर process को equal-size pages में divide किया जाता है और उन्हें अलग-अलग frames में store किया जाता है
Features of Paging (विशेषताएँ):
- Fixed Size Division → memory fixed-size pages में divide होती है
- Hardware Defined Page Size → page size hardware decide करता है
- OS Managed → OS page table maintain करता है
- No External Fragmentation → external fragmentation खत्म हो जाता है
- Internal Fragmentation possible → थोड़ा space waste हो सकता है
- User के लिए invisible → programmer को पता नहीं चलता
Working (कार्य करने का तरीका):
- Process को equal-size pages में divide किया जाता है
- Pages को available frames में load किया जाता है
- Page table के through address mapping होती है
👉 Simple Language (आसान भाषा में):
Paging में process को छोटे-छोटे बराबर size के parts में तोड़कर memory में अलग-अलग जगह रखा जाता है, जिससे memory efficiently use होती है।

Segmentation
Segmentation एक non-contiguous memory allocation technique है, जो Paging की तरह ही होती है, लेकिन इसमें memory को fixed-size pages में नहीं बल्कि variable-size segments में divide किया जाता है।
यह segments program के logical units जैसे:
- functions
- arrays
- data structures
के आधार पर बनाए जाते हैं।
🔹 Features of Segmentation (विशेषताएँ)
- Variable-Size Division
Memory को अलग-अलग size के segments में divide किया जाता है। - User/Programmer-Defined Sizes
Segment का size programmer या compiler decide करता है। - Compiler-Managed
Segmentation mainly compiler द्वारा manage होती है, लेकिन OS भी support करता है। - Supports Sharing and Protection
Segmentation में data और code को आसानी से share और protect किया जा सकता है। - Visible to User
Paging के opposite, Segmentation user/programmer को दिखाई देती है, जिससे control बेहतर होता है।
🔹 Working of Segmentation (कैसे काम करता है)
- Segmentation में main memory और secondary memory को equal parts में divide नहीं किया जाता।
- Memory को different size के segments में divide किया जाता है।
- इन segments को track करने के लिए एक data structure use होता है जिसे segment table कहते हैं।
🔹 Segment Table में क्या होता है
- Base → segment का starting address (memory में कहां से शुरू हो रहा है)
- Limit → segment का size (length)
🔹 Address Translation (Address कैसे बनता है)
जब CPU memory access करता है, तो वह एक logical address generate करता है जिसमें:
- Segment Number
- Offset (distance)
शामिल होता है।
👉 फिर MMU (Memory Management Unit):
- segment number से segment table में entry ढूंढता है
- check करता है कि offset < limit है या नहीं
✔ अगर सही है →
Physical Address = Base + Offset
❌ अगर offset limit से ज्यादा है →
Segmentation Fault (error) आता है

📊 Paging vs Segmentation
| विशेषता (Feature) | Paging | Segmentation |
|---|---|---|
| Division Unit (विभाजन इकाई) | Fixed-size pages | Variable-size segments |
| Managed By (किसके द्वारा नियंत्रित) | Operating System (OS) | Compiler |
| Unit Size Determined By (आकार कौन तय करता है) | Hardware | User / Programmer |
| Address Structure (पता संरचना) | Page number + page offset | Segment number + segment offset |
| Data Structure Used (उपयोग डेटा संरचना) | Page table | Segment table |
| Fragmentation Type (खंडन प्रकार) | Internal fragmentation | External fragmentation |
| Speed (गति) | Faster (तेज़) | Slower (धीमी) |
| Programmer Visibility (दिखाई देना) | User को दिखाई नहीं देता (Invisible) | User को दिखाई देता है (Visible) |
| Sharing (साझा करना) | Difficult (कठिन) | Easy (आसान) |
| Data Structure Handling (डेटा हैंडलिंग) | Inefficient (कम प्रभावी) | Efficient (अधिक प्रभावी) |
| Protection (सुरक्षा) | Implement करना मुश्किल | आसानी से लागू किया जा सकता है |
| Size Constraints (आकार सीमा) | Page size = Frame size | कोई fixed size नहीं |
| Memory Unit Perspective (मेमोरी दृष्टिकोण) | Physical unit | Logical unit |
| System Efficiency (सिस्टम दक्षता) | कम efficient | ज्यादा efficient |