Allocation and Disk Scheduling Methods

Allocation methods तय करती हैं कि disk blocks कहाँ जाते हैं, और disk scheduling methods तय करती हैं कि अगला कौन सा disk request सेवा पाता है।

9 min read · 11 cards · 4 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

एक भीड़भाड़ वाली lab कहानी

मान लीजिए lab server को 3 student files save करनी हैं और साथ ही एक ही समय पर 6 pending disk requests भी सँभालनी हैं। अगर server बुरी तरह चुनता है, files बिखर जाती हैं और disk arm आगे-पीछे move करते समय बर्बाद करता है। इस topic में आपका काम यह देखना है कि OS दोनों फ़ैसले होशियारी से कैसे लेता है।

Theory

इसे एक library की तरह सोचिए

Disk allocation shelves पर किताबें कहाँ रखनी हैं यह तय करने जैसा है, जबकि disk scheduling यह तय करने जैसा है कि counter पर अगला कौन सा student सेवा पाता है।

  • अच्छी shelf placement जगह और search time बचाती है।
  • अच्छा service क्रम इधर-उधर चलना घटाता है, या एक disk में, head movement घटाता है।

Theory

बात, औपचारिक रूप से

Disk allocation methods तय करती हैं कि file data blocks disk पर कैसे store होते हैं, और disk scheduling methods तय करती हैं कि pending disk I/O requests किस क्रम में सँभाली जाती हैं। exams में, दोनों हिस्से साफ़ लिखिए, क्योंकि एक storage layout के बारे में है और दूसरा service क्रम के बारे में।

At a glance

methods के दो परिवार जिन्हें आपको मिलाना नहीं चाहिए।

Methodमुख्य विचारआम समस्या
Contiguous allocationसारे blocks साथ store करेंExternal fragmentation, बढ़ना मुश्किल
Linked allocationblocks को एक chain में store करेंधीमी direct access
Indexed allocationdata blocks की ओर इशारा करने के लिए एक index block इस्तेमाल करेंIndex block overhead
FCFS schedulingrequests आगमन क्रम में सेवा देंबड़ा head movement पैदा कर सकता है
SSTF schedulingसबसे नज़दीकी request पहले सेवा देंदूर की requests भूखी रह सकती हैं
SCAN schedulingएक elevator की तरह move करें और रास्ते में सेवा देंकिनारे की requests इंतज़ार कर सकती हैं

Think first

पहले कोशिश कीजिए

एक file को 4 blocks चाहिए। कौन सी allocation method सबसे अच्छी है अगर आप आसान sequential access चाहते हैं और file ज़्यादा नहीं बढ़ेगी? tap करने से पहले मन में सोचिए।

Show the answer

Contiguous allocation। सारे 4 blocks साथ-साथ बैठते हैं, तो sequential reading को कोई jump बिल्कुल नहीं चाहिए, और क्योंकि file ज़्यादा नहीं बढ़ेगी, contiguous allocation की सामान्य कमज़ोरी (फैलने की जगह नहीं) यहाँ कभी नहीं काटती।

Quiz

कौन सी disk scheduling method requests को सख़्ती से उनके आने के क्रम में सेवा देती है?

  1. FCFS
  2. SSTF
  3. SCAN
  4. C-SCAN
Show the answer

FCFS

FCFS first come first served है, तो यह requests को फिर से क्रमबद्ध नहीं करता। SSTF सबसे नज़दीकी request चुनता है, SCAN एक दिशा में और वापस move करता है, और C-SCAN सिर्फ़ एक दिशा में wrap करता है।

Think first

इसे हल कीजिए

requests इस क्रम में आती हैं: 98, 183, 37, 122, 14, 124, 65, और head 53 से शुरू होता है। FCFS के लिए, कुल head movement क्या है? आगे पढ़ने से पहले कोशिश कीजिए।

Show the answer

jumps चलिए: 53 से 98 है 45, फिर 85, 146, 85, 108, 110, और आख़िर में 124 से 65 है 59। कुल: 45 + 85 + 146 + 85 + 108 + 110 + 59 = 638 cylinders। ग़ौर कीजिए कि FCFS head को पूरे disk में zig-zag करने देता है; SSTF हर बार सबसे नज़दीकी request सेवा देता और इस कुल को तेज़ी से काट देता।

Watch out

जाल

disk allocation को disk scheduling से मत उलझाइए। Allocation जवाब देता है, "file blocks कहाँ store हैं?" Scheduling जवाब देता है, "अगला कौन सा request जाना चाहिए?" exams में, इन्हें मिलाना आम तौर पर आसान marks ले लेता है भले आपकी परिभाषाएँ आंशिक रूप से सही हों।

Quiz

कौन सी allocation method सारे data blocks की ओर pointers store करने के लिए एक अलग index block इस्तेमाल करती है?

  1. Contiguous allocation
  2. Linked allocation
  3. Indexed allocation
  4. FCFS allocation
Show the answer

Indexed allocation

Indexed allocation एक index block इस्तेमाल करता है। Contiguous blocks को साथ store करता है, linked हर block के अंदर pointers store करता है, और FCFS एक allocation method है ही नहीं।

Theory

इसे अभ्यास से जोड़िए

आप इन विचारों को फिर file systems, OS scheduling, और performance सवालों में देखेंगे। एक साफ़-सुथरी exam recipe है: method परिभाषित कीजिए, structure बनाइए, एक फ़ायदा बताइए, एक नुक़सान बताइए, फिर एक use case दीजिए।

Summary

Key takeaways

  • Allocation file block placement तय करता है, scheduling request क्रम तय करता है।
  • Contiguous sequential access के लिए तेज़ है पर बुरी तरह बढ़ता है।
  • Linked contiguity समस्याओं से बचता है पर direct access के लिए कमज़ोर है।
  • Indexed अतिरिक्त index overhead के साथ आसान access support करता है।
  • FCFS सरल है, SSTF movement पर छोटा है, SCAN एक elevator जैसा लगता है।
  • Memory hook, files अच्छी तरह रखो, requests समझदारी से सेवा दो।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Device Management

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati