BCA / B.Tech 13 min read

Allocation of Frames in Hindi

RK

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

प्रकाशित:

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

  • • विषय फोकस: Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Allocation of Frames in Hindi - General Topics
  • • अवलोकन: Quick Answer: Operating system में Allocation of Frames का मतलब है physical memory (RAM) के खाली frames को active processes के बीच सही तरीके से बाँटना।...
  • • मुख्य अवधारणाएं: Frame allocation, Equal proportional priority Hindi, Global local allocation,
Quick Answer: Operating system में Allocation of Frames का मतलब है physical memory (RAM) के खाली frames को active processes के बीच सही तरीके से बाँटना। Virtual memory में physical memory को बराबर size के frames में और logical memory को pages में बाँटा जाता है। OS हर process को उसकी ज़रूरत के हिसाब से frames allocate करता है ताकि page fault कम से कम हों और system thrashing (लगातार page swapping) में न फँसे।

Allocation of Frames in OS क्या है? (Frame Allocation Meaning)

"Allocation" शब्द का सीधा मतलब है बाँटना या सौंपना। Operating system में physical memory (RAM) को fixed-size के टुकड़ों में बाँटा जाता है, जिन्हें frames कहते हैं। इसी तरह secondary storage (hard disk या SSD) पर मौजूद process के logical address space को बराबर size के टुकड़ों में बाँटा जाता है, जिन्हें pages कहते हैं।

जब भी कोई process run होता है, उसके pages को RAM के खाली frames में load किया जाता है। एक process को कितने frames दिए जाएँ, इसी निर्णय और policy को Frame Allocation in OS कहा जाता है।

पुराने systems में memory लगातार एक ही block में दी जाती थी, जिसे समझने के लिए आप पढ़ सकते हैं: Contiguous Allocation in Hindi। Modern virtual memory paging पर चलती है, जहाँ frames का सही allocation सीधे तौर पर system की speed तय करता है।

Advertisement

Frame Allocation की ज़रूरत क्यों पड़ती है? (Need for Frame Allocation)

RAM का size limited होता है, जबकि system में एक साथ कई heavy processes चल रहे होते हैं। अगर OS frames का सही बँटवारा न करे, तो system में ये दिक्कतें आती हैं:

  • Page Faults की बाढ़: अगर किसी process को बहुत कम frames मिलेंगे, तो उसे memory में अपना ज़रूरी page नहीं मिलेगा। बार-बार hard disk से page लाना पड़ेगा, जिसे page fault कहते हैं।
  • CPU Performance में गिरावट: Page fault होने पर CPU को disk I/O का इंतज़ार करना पड़ता है। इससे CPU का active काम रुक जाता है।
  • Thrashing का खतरा: जब process execution करने के बजाय सिर्फ pages को swap-in और swap-out करने में सारा समय गँवा देता है, तो system freeze हो जाता है। इसे thrashing कहते हैं।
  • Memory की बर्बादी: अगर किसी छोटे background process को 50 frames दे दिए जाएँ और heavy software को सिर्फ 10 frames मिलें, तो memory का गलत इस्तेमाल होगा।

Minimum और Maximum Frames की शर्त

OS अपनी मर्जी से किसी process को मनचाहे frames देकर काम नहीं चला सकता। Frame allocation के दो मुख्य नियम होते हैं:

1. Minimum Number of Frames

किसी भी process को execute होने के लिए कम से कम उतने frames चाहिए, जितने उसकी किसी एक single instruction को पूरा करने के लिए एक साथ memory में होने ज़रूरी हैं। यह संख्या computer के hardware architecture (CPU Instruction Set) से तय होती है।

उदाहरण के लिए, मान लें एक assembly instruction है: ADD A, B। इसमें:

  1. Instruction fetch करने के लिए 1 page (frame 1)
  2. Operand A का data पढ़ने के लिए 1 page (frame 2)
  3. Operand B का data पढ़ने और result लिखने के लिए 1 page (frame 3)

अगर CPU indirect addressing इस्तेमाल करता है, तो pointer resolve करने के लिए और frames भी लग सकते हैं। अगर process को कम से कम ये 3 frames नहीं मिलेंगे, तो instruction कभी पूरी नहीं होगी और system लगातार page fault loop में फँस जाएगा।

2. Maximum Number of Frames

एक process को ज़्यादा से ज़्यादा कितने frames मिल सकते हैं, यह physical RAM के कुल size और OS के free-frame pool पर निर्भर करता है। OS कुछ frames हमेशा अपने पास free रखता है ताकि नए I/O buffers और dynamic data structures को तुरंत जगह मिल सके।

Frame Allocation Algorithms in OS (Types)

Operating system में frames को बाँटने के मुख्य रूप से ये तरीके होते हैं:

1. Equal Allocation (बराबर बँटवारा)

इस algorithm में available frames को सभी active processes के बीच बिल्कुल बराबर बाँट दिया जाता है।

मान लें system में कुल available frames m हैं और running processes की संख्या n है, तो हर process को मिलने वाले frames:

Frames per process = m / n

कमी: यह तरीका बहुत आसान है, लेकिन practical नहीं है। एक 5 KB के text editor को भी 20 frames मिलेंगे और 500 MB के database engine को भी 20 frames मिलेंगे। छोटे process के frames खाली पड़े रहेंगे और बड़े process में लगातार page fault होंगे।

2. Proportional Allocation (Size के आधार पर बँटवारा)

इस algorithm में process के virtual size (pages की संख्या) के अनुपात में frames दिए जाते हैं। जो process जितना बड़ा होगा, उसे उतने ज़्यादा frames मिलेंगे।

मान लें:

  • Process $p_i$ का virtual memory size = $s_i$
  • सभी processes का कुल size = $S = \sum s_i$
  • Available physical frames की कुल संख्या = $m$

तो process $p_i$ को मिलने वाले frames ($a_i$) का formula है:

a_i = (s_i / S) * m

3. Priority Allocation (Priority के आधार पर बँटवारा)

कई बार process का size छोटा होता है लेकिन उसका काम बहुत critical होता है (जैसे real-time audio/video processing या OS kernel tasks)। Priority allocation में OS frames का बँटवारा process के size के बजाय उसकी priority के आधार पर करता है। High-priority process को ज़्यादा frames मिलते हैं ताकि उसमें page fault कम से कम हों।

Solved Example: Equal vs Proportional Frame Allocation

Exam में इस topic पर numerical सवाल अक्सर पूछा जाता है। इसे step-by-step हल करके समझते हैं:

Problem Statement: एक system में कुल 100 physical frames हैं। OS ने 10 frames अपने internal free pool के लिए reserve रखे हैं। 3 active processes चल रहे हैं:

  • Process P1 का size = 20 pages
  • Process P2 का size = 50 pages
  • Process P3 का size = 110 pages

Equal Allocation और Proportional Allocation के तहत हर process को कितने frames मिलेंगे?

Step 1: Available Frames निकालना

Available frames (m) = Total frames - Reserved frames
m = 100 - 10 = 90 frames

Step 2: Equal Allocation की calculation

Processes की संख्या (n) = 3
Frames per process = m / n = 90 / 3 = 30 frames

Equal Allocation में P1, P2 और P3 तीनों को 30-30 frames मिलेंगे। यहाँ P1 का कुल size ही 20 pages है, तो उसे 10 extra frames मिल गए जो waste होंगे, जबकि P3 को 110 pages के लिए सिर्फ 30 frames मिले, जिससे उसमें heavy page faults होंगे।

Step 3: Proportional Allocation की calculation

सभी processes का कुल size ($S$):

S = s1 + s2 + s3 = 20 + 50 + 110 = 180 pages

अब formula लगाते हैं a_i = (s_i / S) * m:

  • P1 के frames ($a_1$): $(20 / 180) \times 90 = 10 \text{ frames}$
  • P2 के frames ($a_2$): $(50 / 180) \times 90 = 25 \text{ frames}$
  • P3 के frames ($a_3$): $(110 / 180) \times 90 = 55 \text{ frames}$

Total check: $10 + 25 + 55 = 90 \text{ frames}$। बँटवारा बिल्कुल सही हुआ है।

Comparison Summary Table

Process Process Size (Pages) Equal Allocation Proportional Allocation फायदा किसमें है?
P1 20 30 frames 10 frames Proportional (Memory waste नहीं हुई)
P2 50 30 frames 25 frames Proportional (Balanced allocation)
P3 110 30 frames 55 frames Proportional (कम Page faults)

Global vs Local Frame Replacement

जब किसी process को नए page के लिए frame चाहिए और memory पूरी भर चुकी हो, तो पुराना frame खाली करने की policy दो तरह की होती है:

1. Global Replacement

इस policy में जब किसी process में page fault होता है, तो वह पूरे system के किसी भी frame को replace कर सकता है—चाहे वह frame किसी दूसरे process का ही क्यों न हो।

  • फायदा: System throughput आमतौर पर बेहतर रहता है क्योंकि dynamically frames ज़रूरतमंद process की तरफ चले जाते हैं।
  • नुकसान: एक process का execution time दूसरा process खराब कर सकता है। Process A की वजह से Process B के pages बाहर निकाल दिए जाते हैं।

2. Local Replacement

इस policy में हर process को पहले से कुछ frames allocate कर दिए जाते हैं। जब process में page fault होता है, तो वह सिर्फ अपने ही frames में से किसी page को replace कर सकता है। वह किसी दूसरे process के frame को नहीं ले सकता।

  • फायदा: हर process का performance stable रहता है। कोई दूसरा process उसके pages को memory से बाहर नहीं निकाल सकता।
  • नुकसान: अगर किसी process को कम frames मिले हैं, तो वह बार-बार page fault करता रहेगा, भले ही बगल वाले process के frames खाली पड़े हों।
Advertisement

Global vs Local Replacement Table

Point of Comparison Global Replacement Local Replacement
Frame Selection सभी processes के frames में से किसी को भी चुन सकता है सिर्फ अपने allocated frames में से ही चुन सकता है
Process Independence Processes एक-दूसरे के performance पर असर डालते हैं हर process स्वतंत्र रहता है
Allocated Frames की संख्या समय के साथ बदलती रहती है (Dynamic) निश्चित रहती है (Fixed)
Thrashing का असर पूरे system में फैल सकता है सिर्फ उसी process तक limited रहता है

Thrashing in OS in Hindi: Frame Allocation की सबसे बड़ी समस्या

Students अक्सर search करते हैं "thrashing in os in hindi"। Thrashing और Frame Allocation का गहरा संबंध है।

जब किसी process को उसके Working Set (कम से कम ज़रूरी pages) से कम frames मिलते हैं, तो वह process अपना काम करने के बजाय लगातार page fault solve करने में लग जाता है। जैसे ही वह एक नया page लाता है, उसे तुरंत दूसरे page की ज़रूरत पड़ती है और पुराना page swap-out करना पड़ता है।

इस स्थिति को Thrashing कहते हैं: "A process is thrashing if it is spending more time paging than executing."

Thrashing का Cycle

[कम Frames मिले]
       │
       ▼
[Page Faults बहुत बढ़ गए]
       │
       ▼
[Processes Disk I/O Queue में इंतज़ार करने लगे]
       │
       ▼
[CPU खाली बैठ गया (CPU Utilization गिर गया)]
       │
       ▼
[OS ने सोचा CPU खाली है, और नए Process शुरू कर दिए]
       │
       ▼
[Frames की कमी और बढ़ गई ──> पूरा System Freeze!]

Thrashing को रोकने के उपाय

  1. Working-Set Model: Peter Denning का यह model कहता है कि process पिछले समय में जिन-जिन pages को access करता है, वह उसका working set है। OS को process को कम से कम working set जितने frames ज़रूर देने चाहिए। अगर कुल demand available frames से ज़्यादा हो जाए, तो OS को किसी एक process को temporarily suspend (swap-out) कर देना चाहिए।
  2. Page-Fault Frequency (PFF): OS हर process के page fault rate की upper और lower limit तय करता है। अगर page fault rate upper limit पार कर जाए, तो process को extra frames दो। अगर rate lower limit से नीचे चला जाए, तो उससे frames वापस ले लो।

Kernel अपने internal buffers और tables के लिए memory कैसे allocate करता है, यह जानने के लिए देखें: Kernel Memory Allocation in Hindi।

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

यूनिवर्सिटी exam (BCA / MCA / B.Tech) में अगर "Allocation of Frames in OS" पर 5 marks का सवाल आए, तो direct इन points में लिखें:

  1. Definition: Paging system में physical memory (RAM) के खाली frames को running processes के बीच बाँटना Allocation of Frames कहलाता है।
  2. Minimum Frames Rule: Computer architecture के आधार पर हर process को instruction execution पूरी करने के लिए एक minimum number of frames मिलना ज़रूरी है।
  3. Equal Allocation: सभी processes को बराबर frames मिलते हैं ($a_i = m / n$)। छोटे processes के लिए memory waste होती है, बड़े processes में page faults बढ़ते हैं।
  4. Proportional Allocation: Process size ($s_i$) के अनुपात में frames मिलते हैं ($a_i = (s_i / S) \times m$)। यह सबसे practical तरीका है।
  5. Priority Allocation: High-priority process को low-priority process की तुलना में ज़्यादा frames दिए जाते हैं।
  6. Replacement Policies: Local replacement में process सिर्फ अपने frames replace करता है; Global replacement में system-wide frames लिए जा सकते हैं।
  7. Thrashing: अगर allocated frames working set से कम हों, तो thrashing हो जाती है। इसे रोकने के लिए PFF और Working-Set Model का use होता है।

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

  • Frame और Page में confusion: Page logical memory (hard disk पर program) का हिस्सा होता है, जबकि Frame physical memory (RAM) का हिस्सा होता है। दोनों का size बराबर होता है।
  • Equal allocation को best मानना: कई students सोचते हैं कि बराबरी का बँटवारा सबसे अच्छा है। Real OS में यह खराब साबित होता है क्योंकि सब processes का size अलग होता है।
  • Minimum frames को भूल जाना: Numerical solve करते समय minimum frames की hardware requirement न लिखना marks कटवा देता है।
  • Thrashing का कारण न समझना: Thrashing CPU की खराबी से नहीं होती, बल्कि memory में frames की कमी की वजह से होती है।

Exam के लिए Important Questions

Short Questions (2–3 marks)

  1. Frame Allocation क्या है? (RAM के frames को active processes में बाँटना)
  2. Minimum number of frames किस बात पर निर्भर करता है? (CPU के instruction set architecture पर)
  3. Equal और Proportional allocation का basic formula क्या है? (Equal: $m/n$, Proportional: $(s_i/S) \times m$)
  4. Local और Global replacement में मुख्य अंतर क्या है? (Local सिर्फ अपने frames लेता है, Global किसी का भी frame ले सकता है)
  5. Thrashing क्या है? (जब system execution से ज़्यादा समय paging और swapping में बिताए)

Long Questions (5–10 marks)

  1. Allocation of Frames in OS को detail में समझाइए। Equal और Proportional allocation में अंतर स्पष्ट कीजिए।
  2. Numerical Problem: एक system में 128 frames हैं, 8 OS ने reserve किए हैं। P1 (80 pages), P2 (120 pages) और P3 (200 pages) के बीच Proportional allocation calculate कीजिए।
  3. Thrashing क्या है? यह frame allocation से कैसे जुड़ी है? Working-Set Model से thrashing कैसे control होती है?
  4. Global और Local page replacement strategies की तुलना कीजिए। इनके merits और demerits लिखिए।

FAQs

Allocation of frames in OS क्यों ज़रूरी है?

RAM limited होती है। अगर frames सही तरीके से नहीं बाँटे जाएँगे, तो बड़े processes में बार-बार page fault होंगे और पूरा computer slow होकर thrashing में फँस जाएगा।

Frame allocation और Page replacement में क्या फ़र्क है?

Frame allocation यह तय करता है कि किस process को कितने frames मिलेंगे। Page replacement यह तय करता है कि frame भर जाने पर कौन सा पुराना page बाहर निकाला जाएगा।

क्या एक process को dynamic frames मिल सकते हैं?

हाँ, modern operating systems में Page-Fault Frequency (PFF) का इस्तेमाल होता है। जब process को ज़्यादा memory चाहिए होती है तो उसे extra frames मिलते हैं, और काम खत्म होने पर frames वापस ले लिए जाते हैं।

Thrashing in OS in Hindi का सीधा मतलब क्या है?

जब memory में frames इतने कम पड़ जाते हैं कि CPU normal execution छोड़कर सिर्फ pages को swap-in और swap-out करने में फँस जाता है, तो उसे thrashing कहते हैं। इससे computer पूरी तरह hang हो जाता है।

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

Quick Answer: Operating system में Allocation of Frames का मतलब है physical memory (RAM) के खाली frames को active processes के बीच सही तरीके से बाँटना।
Operating System (OS) Notes in Hindi | ऑपरेटिंग सिस्टम नोट्स के पाठ्यक्रम में Allocation of Frames in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Allocation of Frames in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement

In this Chapter

Allocation of Frames 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
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
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