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

Allocation and Disk Scheduling Methods · Operating System · Gri-Learn