WHY it matters: The CPU is fast; the disk is slow. If the head zig-zags wildly (e.g., serving 50 → 180 → 10 → 170), it wastes huge travel. Reordering can cut travel by half or more — directly speeding up the system.
WHAT we measure: Total head movement =∑∣current−next∣ over the whole service sequence, in cylinders. Lower = better.
There is no magic formula — total head movement is defined as the sum of step distances. Let the head start at h0 and the service order be h0,h1,h2,…,hn.
For SCAN/C-SCAN, the order includes the boundary (0 or max) as an extra stop; for LOOK it does not. That single difference explains all the numbers.
Imagine an elevator in a tall building and people waiting on many floors. The dumb way (FCFS) is to go to whoever pressed first, even if they're at the top, then bottom, then top again — lots of wasted riding. The smart elevator (SCAN/LOOK) keeps going up, picking up everyone on the way, reaches the top, then comes down picking up the rest. C-SCAN is a one-way escalator: it only picks people up going up, zooms back to the ground floor empty, and starts again — so the person on floor 1 never waits forever. The disk head is the elevator; the cylinders are floors; we want the least riding.
Dekho, disk ka head ek physical arm hai jo tracks (cylinders) ke upar move karta hai, aur ye movement slow hota hai — isi ko seek time bolte hain. Jab bahut saare I/O requests queue mein hote hain, toh OS decide kar sakta hai ki kaunsa request pehle serve karna hai. Goal simple hai: total head movement (cylinders mein) minimum karo, taaki disk fast lage.
FCFS matlab jo pehle aaya wahi pehle — fair hai par head idhar-udhar zig-zag karta hai, bahut waste. SCAN ek elevator jaisa hai: head ek direction (maan lo up) mein jaata hai, raaste ke saare requests serve karta hai, disk ke end (199) tak jaata hai, phir reverse hoke neeche ke serve karta hai. LOOK bhi same hai par end tak nahi jaata — sirf last actual request tak jaake reverse ho jaata hai, isliye thoda travel bachta hai. C-SCAN ek one-way escalator hai: sirf up direction mein serve karta hai, end pe pahunch ke seedha 0 pe jump kar jaata hai (beech mein serve nahi karta), phir fresh upward sweep — isse har request ka waiting time uniform rehta hai, koi bhukha (starve) nahi marta.
Formula yaad rakhna easy hai kyunki koi rata-rataya formula nahi: bas service order likho aur consecutive positions ke beech ka absolute difference add karte jao. Jaise start 53 se SCAN up: 199−53=146 upar, phir 199−14=185 neeche, total 331. Har algorithm ka sirf order alag hota hai, sum karne ka tareeka same.
Ek important baat: chhota total hamesha best nahi hota. C-SCAN ka total zyada ho sakta hai (kyunki wo poora disk wapas jump karta hai), par wo fairness deta hai. Exam mein hamesha start position aur direction clearly note karo, aur SCAN vs LOOK ka difference (end touch karta hai ya nahi) confuse mat karna — wahi sabse common galti hai.