BCA / B.Tech 10 min read

Segmentation in Hindi

RK

लेखक Ratan Kumawat · संस्थापक, NotesMedia

प्रकाशित:

त्वरित सारांश और मुख्य बिंदु

  • • विषय फोकस: Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Segmentation in Hindi - General Topics
  • • अवलोकन: Quick Answer: Segmentation meaning in Hindi: आम भाषा में segment का मतलब "टुकड़ा" या किसी चीज़ का logical हिस्सा होता है। Operating system में Segmenta...
  • • मुख्य अवधारणाएं: Segmentation, Segment table protection sharing Hindi, External fragmentation segmentation,Segmentation, Segment table protection sharing, External fragmentation segmentation
Quick Answer: Segmentation meaning in Hindi: आम भाषा में segment का मतलब "टुकड़ा" या किसी चीज़ का logical हिस्सा होता है। Operating system में Segmentation एक non-contiguous memory management तकनीक है, जिसमें किसी process को user के नज़रिए से अलग-अलग logical parts जैसे Main Program, Function, Data, Stack और Heap में बाँटा जाता है। इन सभी टुकड़ों (segments) का आकार variable यानी अलग-अलग होता है। CPU Segment Table की मदद से logical address को physical address में translate करता है, जिससे process को continuous memory की ज़रूरत नहीं पड़ती।

Segmentation Meaning in Hindi (Segmentation क्या है?)

आम बोलचाल में "segment" का मतलब हिस्सा या टुकड़ा होता है। जब किसी बड़े काम या program को उसके स्वाभाविक हिस्सों में बाँटते हैं, तो उसे segmentation कहते हैं।

Operating System (OS) में Segmentation एक memory management scheme है। जब आप C, C++ या Java में code लिखते हैं, तो आप memory को 0 से लेकर आखिरी byte तक की सीधी line की तरह नहीं देखते। एक programmer अपने program को अलग-अलग modules में देखता है:

  • Main program
  • Functions और methods
  • Global और static variables
  • Function calls और local variables के लिए stack
  • Dynamic memory के लिए heap

पुरानी memory management तकनीकों में पूरे process को memory में एक साथ लगातार जगह देनी पड़ती थी। इसे detail में समझने के लिए पढ़ें: Contiguous Allocation in Hindi। उसमें मुश्किल यह थी कि RAM में जगह बिखरी होने पर बड़ा process load नहीं हो पाता था।

Segmentation इसी user view of memory को support करता है। इसमें process के हर logical block को अलग segment बनाकर physical memory (RAM) में अलग-अलग जगह रखा जा सकता है।

Advertisement

Process के Segments (Parts of a Process)

जब कोई program memory में load होता है, तो compiler और OS उसे इन मुख्य segments में बाँटते हैं:

Segment का नाम इसमें क्या store होता है Size
Code / Text Segment Program के executable instructions Fixed (read-only)
Data Segment Global variables और static variables Fixed size
Stack Segment Local variables, parameters और return address Dynamic (कम या ज़्यादा होता रहता है)
Heap Segment Dynamic memory allocation (malloc, calloc, new) Dynamic (runtime पर बढ़ता है)
Symbol Table Compiler symbols और routine names Fixed

हर segment का काम अलग है, इसलिए सबका size भी अलग होता है। यही variable size segmentation का मुख्य feature है।

Segmentation in Hindi

Segment Table का structure: Base address और Limit (length) का representation.

Segment Table और Hardware Architecture

CPU logical address generate करता है। इसे RAM के physical address में बदलने के लिए hardware Segment Table का इस्तेमाल करता है।

Logical Address का Format

CPU जो logical address बनाता है, उसके दो भाग होते हैं:

Logical Address = < Segment Number (s), Offset (d) >
  • Segment Number (s): यह बताता है कि कौन-सा segment access करना है (Segment Table की index)।
  • Offset (d): उस segment के शुरू से लेकर उस specific byte की दूरी।

Segment Table के Fields

Segment Table की हर row में दो ज़रूरी values होती हैं:

  1. Base: RAM का वह starting physical address जहाँ से वह segment शुरू होता है।
  2. Limit: उस segment की कुल लंबाई (size)।

Hardware Registers

  • STBR (Segment Table Base Register): यह RAM में Segment Table के base address को point करता है।
  • STLR (Segment Table Length Register): यह process के कुल segments की संख्या बताता है। अगर s >= STLR हो, तो OS invalid trap देता है।

Address Translation Diagram

            +--------------------------+
            |  Logical Address (s, d)  |
            +------------+-------------+
                         |
           Segment (s)   |   Offset (d)
                |        |       |
                v        |       |
         [Segment Table] |       |
         +-------+-------+       |
       s | Limit | Base  |       |
         +-------+-------+       |
             |       |           |
             v       |           |
        (d < Limit?) |           |
           /    \    |           |
        No/      \Yes            |
         /        \              |
        v          +-------(+)<--+
      TRAP                   |
 (Addressing Error)          v
                     [Physical Address]
                     (Base + Offset d)
                             |
                             v
                       [Main Memory]

Address Translation Steps और Solved Example

Hardware address translate करते समय ये steps लेता है:

  1. CPU logical address <s, d> देता है।
  2. Segment number s से Segment Table की row मिलती है।
  3. Hardware check करता है: क्या d < Limit है?
  4. अगर d >= Limit है, तो CPU trap generate करता है और process में Segmentation Fault आ जाता है।
  5. अगर d < Limit है, तो valid access है:
    Physical Address = Base Address + d

Solved Numerical Example

मान लीजिए एक process की Segment Table यह है:

Segment Number (s) Base Address Limit (Size)
0 1400 1000
1 6300 400
2 4300 400
3 3200 1100
4 4700 1000

नीचे दिए गए logical addresses का physical address निकालिए:

Case 1: Address = (2, 53)

  • s = 2, d = 53.
  • Segment 2 की entry: Base = 4300, Limit = 400.
  • Check: क्या 53 < 400 है? हाँ, valid है।
  • Physical Address = 4300 + 53 = 4353.

Case 2: Address = (3, 852)

  • s = 3, d = 852.
  • Segment 3 की entry: Base = 3200, Limit = 1100.
  • Check: क्या 852 < 1100 है? हाँ, valid है।
  • Physical Address = 3200 + 852 = 4052.

Case 3: Address = (1, 500)

  • s = 1, d = 500.
  • Segment 1 की entry: Base = 6300, Limit = 400.
  • Check: क्या 500 < 400 है? नहीं, 500 limit से बड़ा है।
  • Result: CPU trap generate करेगा (Segmentation Fault / Illegal Memory Access)।

Types of Segmentation in OS

1. Pure Segmentation

इसमें process के हर segment को memory में सीधे continuous space दिया जाता है। इसमें paging use नहीं होती। इसका नुकसान यह है कि segments का size अलग-अलग होने से RAM में External Fragmentation हो जाती है।

2. Segmented Paging (Segmentation with Paging)

Pure segmentation की external fragmentation दूर करने के लिए modern systems में segmentation और paging को मिला दिया जाता है। पहले program को logical segments में बाँटते हैं, फिर हर segment को बराबर size के pages में बाँटते हैं। Frame allocation के बारे में पढ़ें: Allocation of Frames in Hindi और OS memory management के लिए देखें: Kernel Memory Allocation in Hindi।

Segmentation vs Paging in OS (मुख्य अंतर)

Point Paging Segmentation
View Physical memory का view User / Programmer का logical view
Block Size Fixed size (Pages) Variable size (Segments)
Size कौन तय करता है? Hardware और OS Programmer और compiler
Address Page Number (p) + Offset (d) Segment Number (s) + Offset (d)
Table Entry Frame number होता है Base address और Limit दोनों होते हैं
Internal Fragmentation हाँ, आखिरी page में space waste हो सकता है नहीं होती, क्योंकि segment ज़रूरत जितना ही बनता है
External Fragmentation बिल्कुल नहीं होती हाँ, segments के बीच खाली space छूटने से होती है
Protection और Sharing मुश्किल होती है बहुत आसान और natural होती है
Advertisement

Protection और Sharing in Segmentation

1. Protection

Segment Table में हर entry के साथ protection bits जुड़ते हैं:

  • Read/Write bits: Code segment को read-only और data segment को read-write बनाया जाता है।
  • Limit check: Offset limit से कम होना चाहिए, जिससे कोई process दूसरे segment के data में दखल न दे सके।

2. Sharing

अगर कई users एक ही program (जैसे text editor या compiler) चला रहे हैं, तो उसका code segment RAM में एक ही बार load होता है। सभी users की Segment Table उसी base address को point करती है। लेकिन सबका data segment अलग रहता है। इससे RAM की बहुत बचत होती है।

Advantages और Disadvantages of Segmentation

Advantages Disadvantages
User view से match करता है (program को modular बनाता है)। External fragmentation होती है, जिससे memory compaction करनी पड़ती है।
Internal fragmentation नहीं होती। Dynamic allocation के लिए Best Fit या First Fit algorithms लगाने पड़ते हैं।
Code और data modules को share करना बहुत आसान है। Address translation में limit check और table lookup का extra overhead होता है।
Segment Table का size आम तौर पर Page Table से छोटा होता है। Stack या heap का size runtime पर बहुत बढ़ जाए तो memory manage करना कठिन होता है।

Exam में कैसे लिखें (5 Marks Ready Answer)

Exam में सवाल आने पर इन points में answer लिखें:

  1. Definition: Segmentation एक non-contiguous memory management technique है जो process को variable size के logical parts (segments) में बाँटती है।
  2. Segments के नाम: Code, Data, Stack और Heap।
  3. Logical Address: <Segment Number (s), Offset (d)>।
  4. Segment Table: इसमें दो fields होते हैं - Base (starting address) और Limit (segment size)।
  5. Formula: अगर d < Limit है, तो Physical Address = Base + d। अगर d >= Limit है, तो Trap (Segmentation Fault)।
  6. Diagram: CPU (s, d) -> Segment Table -> limit check -> adder Base + d -> Physical Memory।
  7. Advantage: Internal fragmentation नहीं होती; sharing आसान है।
  8. Disadvantage: External fragmentation होती है।

Students की Common Mistakes

  • Mistake 1: Base और Limit में confusion. Limit का मतलब size है और Base का मतलब RAM का starting address है। इन्हें आपस में न बदलें।
  • Mistake 2: Internal fragmentation मान लेना. Segmentation में internal fragmentation नहीं होती, इसमें External Fragmentation होती है।
  • Mistake 3: Limit check छोड़ देना. Numerical हल करते समय पहले check करें कि offset < limit है या नहीं। अगर offset बड़ा है तो direct जोड़ें नहीं, Trap लिखें।
  • Mistake 4: Paging और Segmentation को mix करना. Paging fixed size blocks बनाती है, जबकि segmentation variable size logical blocks बनाती है।

Exam के लिए Important Questions

Short Questions (2–3 marks)

  1. Segmentation क्या है? (Process को Code, Data, Stack जैसे logical segments में बाँटने की variable-size memory management technique।)
  2. Segment Table में Base और Limit का क्या role है? (Base segment का starting physical address देता है और Limit उसका maximum size तय करता है।)
  3. Segmentation में Trap कब आता है? (जब offset d >= Limit हो जाता है, यानी process अपनी सीमा से बाहर access करता है।)
  4. Paging और Segmentation में fragmentation का फ़र्क बताइए। (Paging में internal fragmentation होती है; Segmentation में external fragmentation होती है।)
  5. Segmented Paging क्यों use होती है? (Pure segmentation की external fragmentation समस्या को खत्म करने के लिए।)

Long Questions (5–10 marks)

  1. Segmentation in OS क्या है? Address translation hardware का neat diagram बनाकर काम करने का तरीका समझाइए।
  2. Paging और Segmentation के बीच कम से कम 6 अंतरों की तुलना table बनाकर कीजिए।
  3. Segmentation में Protection और Sharing कैसे काम करती है? Example देकर समझाइए।
  4. एक process की Segment Table में Segment 0 (Base 2000, Limit 500) और Segment 1 (Base 5000, Limit 300) हैं। Logical addresses (0, 350) और (1, 450) के physical address निकालिए।

FAQs

Segmentation meaning in Hindi क्या है?

Segmentation का Hindi में सीधा मतलब logical टुकड़ों में विभाजन करना है। Operating system में इसका मतलब program को उसके स्वाभाविक अंगों जैसे function, data और stack के आधार पर अलग-अलग size के segments में बाँटना है।

Segmentation in OS में internal fragmentation क्यों नहीं होती?

Internal fragmentation तब होती है जब block का size fix हो और data कम हो। Segmentation में segment को उतनी ही memory दी जाती है जितनी उसकी ज़रूरत होती है, इसलिए अंदर space waste नहीं होता।

Customer segmentation और OS segmentation में क्या फ़र्क है?

Customer segmentation marketing का term है जहाँ ग्राहकों को पसंद या उम्र के हिसाब से बाँटते हैं। OS segmentation computer memory का concept है जहाँ process के code और data को memory blocks में बाँटते हैं।

Segmentation Fault क्या है?

जब कोई program ऐसी memory address access करने की कोशिश करता है जो उसके segment की limit से बाहर है या जिसकी permission नहीं है, तो OS hardware trap से उस program को रोक देता है। इसे ही Segmentation Fault कहते हैं।

Segment Table कहाँ रहती है?

Segment Table main memory (RAM) में रहती है। CPU का STBR register इसके starting address को point करता है।

अक्सर पूछे जाने वाले प्रश्न (FAQs)

Quick Answer: Segmentation meaning in Hindi: आम भाषा में segment का मतलब "टुकड़ा" या किसी चीज़ का logical हिस्सा होता है।
Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स के पाठ्यक्रम में Segmentation in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Segmentation in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement

In this Chapter

Segmentation in Hindi
Distributed System in Hindi
Real Time System in Hindi
System Calls in Hindi
System Program in Hindi
Structure of Operating System in Hindi
Layers Design of Structure in Hindi
Unix in Hindi
Virtual Machine in Hindi
Kernel-Based Operating System in Hindi
Process in Hindi – OS में Process क्या है
Interacting Processes in Hindi
Threads in Hindi
Fundamental of Schedulling in Hindi
Scheduling Criteria in Hindi
Long Medium Short Term Scheduling in Hindi
Scheduling Algorithms in Hindi
Structure of Concurrent System in Hindi
Critical Region in Hindi
Critical Section in Hindi
Inter process Communication in Hindi
Monitor in Hindi
Semaphore in OS in Hindi – Counting और Binary Semaphore
Semaphores Implementation & Uses in Hindi
Logical and Physical Address in Hindi
Swapping in Hindi
Contiguous Allocation in Hindi
Paging in OS in Hindi – Paging और Segmentation
Paging with Segmentation in Hindi
kernel Memory Allocation in Hindi
Page Replacement Algorithms in Hindi
Virtual Memory in Hindi
Virtual Memory with demand Paging in Hindi
Deadlock & Characterization in Hindi
Methods for Handling Deadlocks in Hindi
Deadlock Thrashing in Hindi
Allocation of Frames in Hindi
Virtual Memory using Segmentation in Hindi
Interprocess Communication protocol in Hindi
Network Operating System in Hindi
Design Issues in Distributed File System in Hindi
Network Structure in Hindi
Structure Distributed System in Hindi
File System and Coordination in Hindi
Linux in Hindi
Commands of Linux in Hindi | लिनक्स के कमांड्स हिंदी में
Programmer Interface & File manipulation in Hindi
Process control in Linux in Hindi
Linux Kernel & Signals in Hindi
File System in Linux in Hindi
block & inodes in Hindi
System Editor in Hindi
Character Transliteration in Hindi
ED in Hindi
Vi Editor & There Commands in Hindi
Shell Script in Hindi
Looping & Decision Making in Hindi
Variables & File name Expansion in Hindi
Array in Hindi OS
Sub Program in Hindi
C interface with Linux in Hindi
Simpel Shell Programs in Hindi
BCA Part-1 | Operating Systems | Semester-I | MDSU Exam Paper 2023 (Held in 2024)
What is Operating System (OS) in Hindi
Operating System (OS) All Important Questions and Answers in Hindi (MDSU)
BCA || Operating System 2025 Paper || MDSU Exam Paper
BCA | OS(Operating System) 2023 Paper | MDSU Exam Paper
Type of Operating System in Hindi
Goals of Operating System in Hindi
Operation of Operating system in Hindi
Resource Allocation & Functions in Hindi
class of Operating system in Hindi
Batch Processing in Hindi
Multi Processing in Hindi
Time Sharing in Hindi