BCA / B.Tech 13 min read

Contiguous Allocation in Hindi

RK

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

प्रकाशित:

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

  • • विषय फोकस: Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Contiguous Allocation in Hindi - General Topics
  • • अवलोकन: Quick Answer: Operating system में Contiguous Allocation memory और storage allocation का एक तरीका है, जिसमें किसी process या file को लगातार (unbroken s...
  • • मुख्य अवधारणाएं: Contiguous allocation, Fixed variable partitions Hindi, Fragmentation compaction,Contiguous allocation, Fixed variable partitions, Fragmentation compaction
Quick Answer: Operating system में Contiguous Allocation memory और storage allocation का एक तरीका है, जिसमें किसी process या file को लगातार (unbroken sequence में) memory blocks या disk blocks दिए जाते हैं। इसका मतलब है कि पूरा data बीच में बिना किसी गैप के एक साथ store होता है। इससे sequential access और direct access बहुत fast हो जाता है, लेकिन इसकी मुख्य कमी external fragmentation है, जिससे free space बिखरा होने पर भी नए process को जगह नहीं मिल पाती।

Contiguous Allocation in OS क्या है? (Contiguous Meaning in Hindi)

"Contiguous" शब्द का साधारण हिंदी मतलब है लगातार, सटा हुआ या बिना किसी रुकावट के एक के बाद एक जुड़ा होना। Computer science और operating system में जब हम contiguous memory location की बात करते हैं, तो इसका अर्थ ऐसे memory blocks से होता है जिनके physical addresses लगातार क्रम में (consecutive order में) होते हैं।

Operating system में Contiguous Allocation दो मुख्य जगहों पर इस्तेमाल होता है:

  • Main Memory (RAM) Allocation: जब CPU किसी program को run करने के लिए RAM में load करता है, तो पूरे process को memory का एक continuous block दिया जाता है।
  • File System (Secondary Storage / Disk) Allocation: जब hard disk पर कोई file save की जाती है, तो उसे disk sectors या disk blocks का लगातार set दिया जाता है। File system की basic working समझने के लिए देखें: File System and Coordination in Hindi.

Contiguous allocation में OS को हर file या process के लिए सिर्फ दो basic जानकारियाँ track करनी होती हैं:

  1. Starting Address (Start Block): Data memory या disk में किस block number से शुरू हो रहा है।
  2. Length (Size): Process या file कितने continuous blocks ले रही है।
Contiguous Allocation in Hindi

Contiguous allocation का diagram: memory में process या file को लगातार blocks में जगह मिलती है।

Advertisement

Contiguous Allocation Diagram और Disk Representation

Disk storage में contiguous allocation को समझना बहुत आसान है। मान लीजिए disk पर 0 से 11 तक blocks हैं। File system की directory entry में सिर्फ file का नाम, start block और length लिखी होती है:

Directory Entry:
+-----------+-------------+--------+
| File Name | Start Block | Length |
+-----------+-------------+--------+
| text.doc  | 2           | 4      |
| song.mp3  | 7           | 3      |
+-----------+-------------+--------+

Disk Blocks:
[0] [1] [2:text] [3:text] [4:text] [5:text] [6:Free] [7:song] [8:song] [9:song] [10:Free] [11:Free]

यहाँ text.doc block 2 से शुरू होकर 4 blocks लेती है (blocks 2, 3, 4, 5)। song.mp3 block 7 से शुरू होकर 3 blocks लेती है (blocks 7, 8, 9)।

इस layout का सबसे बड़ा फ़ायदा Direct Access (Random Access) है। अगर CPU को file का k-th block पढ़ना है, तो OS सीधे calculation कर लेता है: Physical Block = Start Block + k। OS को linked lists की तरह बीच के blocks traverse नहीं करने पड़ते। Disks और block architecture को detail में समझने के लिए पढ़ें: Block and Inodes in Hindi.

Types of Contiguous Memory Allocation in OS

Main memory (RAM) management में contiguous memory allocation मुख्य रूप से दो तरीकों से किया जाता है:

1. Fixed-size Partitioning (Static Partitioning)

इस scheme में RAM को system boot होने के समय ही fixed संख्या में blocks (partitions) में बाँट दिया जाता है। हर partition का size बराबर भी हो सकता है और अलग-अलग भी, लेकिन एक बार तय होने के बाद size बदला नहीं जा सकता।

  • हर partition में एक समय पर सिर्फ एक ही process आ सकता है।
  • Degree of multiprogramming partitions की कुल संख्या पर निर्भर करती है।
  • Problem: अगर 100 KB का partition है और उसमें 40 KB का process load हुआ, तो अंदर के 60 KB बेकार रह जाते हैं। इसे Internal Fragmentation कहते हैं।

2. Variable-size Partitioning (Dynamic Partitioning)

इस scheme में memory को पहले से fixed blocks में नहीं बाँटा जाता। जब कोई नया process आता है, तो OS उसकी ज़रूरत के अनुसार ठीक उतने ही size का continuous block free memory (hole) में से काट कर दे देता है।

  • शुरुआत में पूरी RAM एक बड़ा free hole होती है। जैसे-जैसे processes आते और जाते हैं, memory में अलग-अलग sizes के खाली holes बन जाते हैं।
  • इसमें internal fragmentation नहीं होता, क्योंकि process को जितनी ज़रूरत होती है, उतनी ही space दी जाती है।
  • Problem: जब processes memory छोड़ते हैं, तो छोटे-छोटे खाली टुकड़े scattered रह जाते हैं। इसे External Fragmentation कहते हैं।

Fixed vs Variable Partitioning Comparison Table

Feature Fixed Partitioning Variable Partitioning
Partition Size पहले से fixed (static) Process की demand के अनुसार dynamic
Degree of Multiprogramming Limited (partitions की गिनती जितनी) Dynamic (RAM size और process sizes पर निर्भर)
Internal Fragmentation हाँ, गंभीर समस्या है नहीं होती
External Fragmentation नहीं होती हाँ, मुख्य समस्या है
Implementation बहुत सरल मध्यम (free holes track करने पड़ते हैं)

Memory Allocation Strategies: First Fit, Best Fit, Worst Fit

Dynamic partitioning में जब किसी नए process को memory देनी होती है, तो OS खाली holes की list में से उपयुक्त hole चुनने के लिए तीन standard algorithms इस्तेमाल करता है:

Strategy काम करने का तरीका Speed Memory Utilization
First Fit Memory की शुरुआत से scan करता है और जो पहला hole process के size से बड़ा या बराबर मिले, allocate कर देता है। सबसे तेज़ (Fastest) अच्छा (practical systems में best)
Best Fit पूरी memory scan करता है और सबसे छोटा hole चुनता है जो process के लिए काफ़ी हो (ताकि leftover space सबसे कम बचे)। धीमा (पूरा search) बहुत छोटे-छोटे बेकार holes छोड़ता है
Worst Fit पूरी memory scan करता है और सबसे बड़ा उपलब्ध hole चुनता है, ताकि बचा हुआ space इतना बड़ा हो कि किसी दूसरे process के काम आ सके। धीमा (पूरा search) अक्सर सबसे खराब साबित होता है

Solved Example: Dynamic Allocation Step-by-Step Trace

BCA और B.Tech exams में अक्सर numericals पूछे जाते हैं। आइए एक realistic scenario trace करके देखें:

मान लीजिए memory में 5 free holes इस क्रम में उपलब्ध हैं: 100 KB, 500 KB, 200 KB, 300 KB, 600 KB।
चार नए processes इस order में आते हैं: P1 (212 KB), P2 (417 KB), P3 (112 KB), P4 (426 KB)।

First Fit का Trace

  • P1 (212 KB): 100 KB छोटा है। 500 KB बड़ा है, इसलिए P1 को 500 KB वाले hole में डाला गया। बचा हुआ hole = 500 − 212 = 288 KB।
  • P2 (417 KB): 100 KB (छोटा), 288 KB (छोटा), 200 KB (छोटा), 300 KB (छोटा), 600 KB (काफ़ी है)। P2 को 600 KB वाले hole में डाला गया। बचा हुआ hole = 600 − 417 = 183 KB।
  • P3 (112 KB): 100 KB (छोटा), 288 KB (काफ़ी है)। P3 को 288 KB वाले hole में डाला गया। बचा हुआ hole = 288 − 112 = 176 KB।
  • P4 (426 KB): उपलब्ध holes: 100 KB, 176 KB, 200 KB, 300 KB, 183 KB। कोई भी अकेला hole 426 KB का नहीं है! P4 wait करेगा।

Best Fit का Trace

Process Process Size उपलब्ध Holes चुना गया Best Hole Allocation के बाद बचा हुआ Hole
P1 212 KB 100 KB, 500 KB, 200 KB, 300 KB, 600 KB 300 KB (smallest hole ≥ 212 KB) 88 KB
P2 417 KB 100 KB, 500 KB, 200 KB, 88 KB, 600 KB 500 KB (smallest hole ≥ 417 KB) 83 KB
P3 112 KB 100 KB, 83 KB, 200 KB, 88 KB, 600 KB 200 KB (smallest hole ≥ 112 KB) 88 KB
P4 426 KB 100 KB, 83 KB, 88 KB, 88 KB, 600 KB 600 KB (smallest hole ≥ 426 KB) 174 KB

Result Analysis: Best Fit में P1, P2, P3 और P4 चारों processes को memory मिल गई, जबकि First Fit में P4 रुक गया था। यह साफ़ दिखाता है कि memory allocation algorithm का चुनाव performance और capacity utilization को कितना बदल देता है।

External Fragmentation और Compaction

Contiguous allocation की सबसे बड़ी चुनौती External Fragmentation है।

External Fragmentation क्या है? जब memory में कुल मिलाकर काफी free space उपलब्ध होता है, लेकिन वह space लगातार (contiguous) न होकर छोटे-छोटे टुकड़ों में बिखरा हुआ होता है, तो OS किसी नए process को load नहीं कर पाता। इसे external fragmentation कहते हैं।

उदाहरण के लिए, अगर system में 50 KB और 60 KB के दो अलग-अलग free blocks हैं (total free = 110 KB), और एक नया process 90 KB का आता है, तो contiguous allocation में उसे space नहीं दी जा सकती क्योंकि continuous 90 KB कहीं नहीं है।

External Fragmentation के Solutions

  1. Compaction (Defragmentation): OS सारे loaded processes को memory में एक तरफ shift कर देता है, ताकि सारे छोटे-छोटे free holes मिलकर एक बड़ा continuous free hole बन जाएँ।
    Before Compaction:
    [Process A] [Free: 50 KB] [Process B] [Free: 60 KB]
    
    After Compaction:
    [Process A] [Process B] [--- Combined Free Space: 110 KB ---]
    
    Compaction सिर्फ तभी संभव है जब program का address binding Execution time (Dynamic Relocation) पर हो और hardware base register support करता हो। Compaction का drawback यह है कि इसमें CPU overhead और time बहुत ज़्यादा लगता है।
  2. Non-Contiguous Allocation (Paging & Segmentation): आधुनिक OS contiguous allocation की जगह memory को fixed pages में बाँटकर non-contiguous जगह देते हैं। Frames और paging architecture के बारे में यहाँ पढ़ें: Allocation of Frames in Hindi और low-level memory handling के लिए देखें: Kernel Memory Allocation in Hindi.
Advertisement

Contiguous vs Non-Contiguous Allocation

Feature Contiguous Allocation Non-Contiguous Allocation (Paging)
Data Placement लगातार (continuous) blocks में Memory में कहीं भी बिखरे हुए blocks (pages) में
Access Speed बहुत तेज़ (sequential और direct दोनों) धीमा (page table lookup overhead होता है)
Address Translation सरल: Base Register + Offset Page Table, TLB और Frame numbers की आवश्यकता
External Fragmentation गंभीर समस्या है बिल्कुल नहीं होती
File/Process Growth कठिन (आगे block खाली न हो तो relocate करना पड़ता है) आसान (नया frame कहीं भी जोड़ सकते हैं)

Advantages और Disadvantages of Contiguous Allocation

Advantages (फायदे) Disadvantages (कमियाँ)
Fast Access Speed: Data लगातार blocks में होने के कारण sequential और direct access दोनों बहुत तेज़ होते हैं। Head movement कम होती है। External Fragmentation: Memory में छोटे-छोटे बेकार holes बन जाते हैं, जिससे space बर्बाद होती है।
Simple Directory Structure: सिर्फ Start Block number और Length store करनी पड़ती है। Data structures बहुत हल्के होते हैं। File Growth Problem: अगर file का size बाद में बढ़ता है और आगे वाला block भरा है, तो पूरी file को नई जगह copy करना पड़ता है।
Easy Address Calculation: Physical address निकालना बहुत आसान होता है: Base Address + Offset। Size Estimation Issue: File बनाते समय user या program को पहले से बताना पड़ता है कि file कितनी बड़ी होगी।

Exam में कैसे लिखें (5 marks)

अगर University exam (MDSU / RTU / Rajasthan University) में 5 marks का question आए, तो answer sheet में सीधे point-to-point इस format में लिखें:

  1. Definition (1 mark): Contiguous Allocation वह allocation तकनीक है जिसमें किसी process या file को memory या disk के लगातार (consecutive) blocks allocate किए जाते हैं।
  2. Tracking Information (1 mark): OS सिर्फ दो parameters record करता है: Starting Block Address और Length (Total Blocks)।
  3. Address Formula (1 mark): Physical Address = Base Address + Logical Address (Offset)। Direct access का formula: Block Number = Start Block + Offset Block।
  4. दो मुख्य फायदे (1 mark):
    • Direct access और sequential access दोनों की speed बहुत तेज होती है।
    • Implementation बहुत सरल है और overhead कम होता है।
  5. दो मुख्य नुकसान (1 mark):
    • Dynamic allocation में External Fragmentation की समस्या होती है, जिसके लिए compaction की ज़रूरत पड़ती है।
    • File का size dynamic रूप से बढ़ाना बहुत मुश्किल होता है।

Common Mistakes जो Students करते हैं

  • RAM allocation और Disk allocation में confuse होना: कई students सोचते हैं कि contiguous allocation सिर्फ RAM में होता है। वास्तव में यह secondary storage (Hard Disk / File System) पर files store करने के लिए भी एक classic तकनीक है।
  • Internal और External Fragmentation को उल्टा लिख देना: Fixed partitioning में internal fragmentation होती है (block बड़ा, process छोटा)। Variable partitioning में external fragmentation होती है (total free space काफी है, पर continuous block नहीं मिल पाता)।
  • Best Fit को हमेशा "Best" मान लेना: Best Fit नाम से अच्छा लगता है, लेकिन असल में यह सबसे छोटे-छोटे बेकार holes छोड़ता है जिन्हें compaction के बिना इस्तेमाल नहीं किया जा सकता। Practical systems में First Fit अक्सर Best Fit से तेज़ और बेहतर memory utilization देता है।
  • Compaction को हमेशा संभव मानना: Compaction सिर्फ तभी काम कर सकता है जब execution-time dynamic relocation hardware (Base/Limit registers) system में मौजूद हो। अगर code compile-time पर static bind हो चुका है, तो उसे memory में shift नहीं किया जा सकता।

Exam के लिए Important Questions

Short Questions (2–3 marks)

  1. Contiguous allocation क्या है? define कीजिए। (Memory या storage में process/file को लगातार consecutive blocks देना)
  2. Contiguous memory allocation में directory entry में क्या store होता है? (Start Block number और Length)
  3. External Fragmentation क्या है? (कुल free memory उपलब्ध होने पर भी continuous space न मिलने के कारण process load न हो पाना)
  4. Compaction क्या होता है? (Memory के fragmented free holes को एक साथ मिलाकर एक बड़ा continuous block बनाना)
  5. First Fit और Best Fit में कौन सा algorithm तेज़ है? (First Fit तेज़ है क्योंकि यह पूरी memory scan नहीं करता)

Long Questions (5–10 marks)

  1. Contiguous Memory Allocation क्या है? Fixed Partitioning और Variable Partitioning का अंतर diagrams के साथ समझाइए।
  2. Dynamic memory allocation के strategies (First Fit, Best Fit, Worst Fit) की तुलना कीजिए। Example के ज़रिए trace करके दिखाइए।
  3. Contiguous File Allocation के advantages और disadvantages लिखिए। इसमें External Fragmentation की समस्या को कैसे दूर किया जाता है?

FAQs

Contiguous meaning in Hindi क्या है?

Contiguous का हिंदी में मतलब "सटा हुआ", "लगातार" या "एक के बाद एक जुड़ा हुआ" होता है। Computer memory के context में इसका अर्थ बिना किसी गैप के एक के बाद एक जुड़े हुए physical memory addresses से है।

Contiguous memory allocation in OS in Hindi क्या होता है?

यह OS का ऐसा memory management system है जहाँ हर process को RAM में सिर्फ एक unbroken, continuous memory block दिया जाता है, ताकि address translation साधारण addition (Base + Offset) से हो सके।

Contiguous allocation में file grow क्यों नहीं कर पाती?

अगर file को blocks 4, 5, 6 दिए गए हैं और block 7 पहले से किसी दूसरी file के पास है, तो पहली file में नया data append करने पर block 7 नहीं मिल सकता। ऐसे में पूरी file को किसी नए, बड़े continuous area में copy करना पड़ता है।

External fragmentation और Internal fragmentation में क्या मुख्य फ़र्क है?

Internal fragmentation allocated partition के अंदर बची हुई बेकार space है (fixed blocks में)। External fragmentation दो allocated blocks के बीच बाहर छूटी हुई free space है, जो अलग-अलग इतनी छोटी है कि नया process fit नहीं हो पाता।

Compaction कब संभव होता है?

Compaction सिर्फ तभी संभव होता है जब processes dynamic relocation support करते हों, यानी programs का logical address runtime पर hardware base register की मदद से physical address में convert होता हो।

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

Quick Answer: Operating system में Contiguous Allocation memory और storage allocation का एक तरीका है, जिसमें किसी process या file को लगातार (unbroken sequence में) memory blocks या disk blocks दिए जाते हैं।
Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स के पाठ्यक्रम में Contiguous Allocation in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Contiguous Allocation in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement

In this Chapter

Contiguous Allocation 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
Segmentation 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