4.2.34 · D1 · HinglishOperating Systems

FoundationsFile allocation — contiguous, linked, indexed (inode)

2,022 words9 min read↑ Read in English

4.2.34 · D1 · Coding › Operating Systems › File allocation — contiguous, linked, indexed (inode)

Parent note (File allocation — contiguous, linked, indexed (inode)) padhne se pehle, tumhe us chhote alphabet mein fluent hona chahiye jo woh bina rukke use karta hai. Yeh page har letter ko kuch nahi se build karta hai.


0. Disk as an array of boxes

Poora subject ek picture par tika hai: disk numbered boxes ki ek row hai, sab ek hi size ki.

Figure — File allocation — contiguous, linked, indexed (inode)

1. — the block size (bytes per box)

  • Plain words: ek box kitna data hold kar sakta hai.
  • Picture: shelf figure mein ek single box ki height — capacity ka ek container.
  • Yeh topic isko kyun chahiye: har "is file ko kitne boxes chahiye?" aur "byte 9000 kis box mein hai?" waala sawaal se division ya multiplication hai. Yeh bytes (jo users mein sochte hain) aur blocks (jo disks mein sochte hain) ke beech conversion rate hai.

2. Ek byte, aur file ke andar byte-numbering

  • Picture: agar ek block ek box hai, toh ek byte uske andar ek tiny cell hai. ke block mein cells se tak numbered hote hain.
  • Yeh topic isko kyun chahiye: users poochte hain "mujhe byte 9000 do." OS ko woh flat byte-number translate karni hoti hai (kaun sa box, uske andar kaun si cell) mein. Yahi translation har scheme ka dil hai.

3. Logical block vs. physical block

Yeh poore parent page par sabse zyada important distinction hai. Do alag numbering systems ek saath rehte hain.

Figure — File allocation — contiguous, linked, indexed (inode)
  • Picture: figure mein top row file ke apne pieces hain; arrows neeche disk par scattered boxes tak jaate hain. Same data, do naam.
  • Yeh topic isko kyun chahiye: allocation wahi function hai jo logical ko physical mein badalta hai. Parent page ka har formula — , — us same arrow ke liye bas ek alag rule hai.

4. — file length in blocks

  • Plain words: is file ko kitne boxes chahiye.
  • Picture: mapping figure mein top-row pieces gino — woh count hai.
  • Yeh topic isko kyun chahiye: contiguous allocation sirf pair store karta hai aur kuch nahi. humein ki valid range bhi batata hai: block ya usse aage maangna file ke end ke past read karna hai.

5. Byte number ko (block, offset) mein convert karna

Ab hum parent ka pehla worked example symbol-for-symbol padh sakte hain.

Figure — File allocation — contiguous, linked, indexed (inode)
  • Picture: file ke bytes ko end to end rakho aur har bytes ko ek box mein kaato. Floor batata hai byte kis box mein pada; modulo batata hai kitna andar (cell).

6. — the pointer size

  • Picture: ek chhota arrow jo ek box ke andar draw kiya gaya hai, doosre box ki taraf point karta hua. Woh arrow draw karna box ki apni space ke bytes kharcha karta hai.
  • Yeh topic isko kyun chahiye:
    • Linked allocation mein pointer har data box ke andar rehta hai, isliye usable data hai.
    • Indexed allocation mein ek index box poori tarah pointers se bhara hota hai, isliye usmein pointers aate hain.

7. — pointers per block

  • Picture: ek khali box chhote slots mein divided, har slot mein ek arrow.
  • Yeh topic isko kyun chahiye: yeh single number poori inode size calculation drive karta hai. Ek index box data blocks tak pahuncha sakta hai; indirection ka har extra level reach ko se multiply karta hai → , , .
  • Numbers: , ke saath: .

8. Big-O — the cost language ( vs )

Figure — File allocation — contiguous, linked, indexed (inode)
  • Picture: file position ke against do curves. ek flat line hai (hamesha ek lookup). ek rising straight line hai (block ka cost reads hai).
  • Yeh topic isko kyun chahiye: yahi woh yardstick hai jo poori comparison table use karti hai. "Fast random access" ka matlab hai; "slow random access" ka matlab hai. Contiguous aur indexed hain; plain linked hai.

9. Do words jo milenge: fragmentation & inode


Prerequisite map

Disk as numbered boxes

Block size B

Physical block b

Byte and byte numbering

floor and modulo

logical block i

Length L

pointer size p

k pointers per block

Big-O cost O1 vs On

File allocation schemes

Har arrow kehta hai "right wali idea samajhne se pehle left wali idea chahiye." Sab kuch parent note parent note par teen schemes mein funnel ho jaata hai.


  • Free Space Management (bitmap, free list) — OS kaise ek free box dhundh ke deta hai.
  • File Systems (ext4, FAT, NTFS) — real systems jo yeh schemes implement karte hain.
  • Directory Structure — jahan "start block" / "inode number" actually stored hota hai.
  • Disk Scheduling — ek "seek" ki cost jo contiguous layout ko attractive banati hai.
  • Virtual Memory Paging — same logical→physical mapping idea, RAM ke liye.
  • 🇮🇳 Hinglish version

Equipment checklist

A block is…
disk ka ek fixed-size chunk, sabse chhoti unit jo read/write hoti hai; ek single integer se address hoti hai.
stands for…
block size — ek block mein bytes ki sankhya (jaise 4096).
Logical block means…
ek particular file ka -waan piece, 0 se count kiya gaya (file ki private numbering).
Physical block means…
disk par actual box number, jo sari files ke beech shared hai (actual address).
The job of "file allocation" is…
logical block se physical block tak ka map provide karna.
is…
file ki length blocks mein; valid indices hain.
Byte kis logical block aur offset mein rehta hai?
block , offset .
(floor) kya karta hai…
nearest whole number tak round down karta hai.
kya deta hai…
ko se divide karne ke baad remainder.
hai…
pointer size — ek block address store karne ke liye bytes chahiye (jaise 4).
count karta hai…
ek full block mein kitne pointers (block addresses) fit hote hain.
ke saath,
.
vs ka matlab…
size se independent constant work, vs. block index ke anupat mein badhta kaam.