Yeh page assume karta hai ki tumne pahle almost kuch nahi dekha. Isse pahle ki tum parent note locality ke baare mein padh sako, humein uske har word ko earn karna hoga: address, memory location, access, reference, cache, block, hit/miss, reuse distance, stride, aur woh arithmetic notation ke bits (Ai, ∣⋅∣, ⌈⋅⌉, ∑, P(⋅)) jis par woh rely karta hai. Hum inhe bilkul usi order mein build karenge jis order mein yeh ek dusre par depend karte hain.
Sab kuch yahan se shuru hota hai. Circuits bhool jao — ek bahut lambi street imagine karo jisme identical boxes ek row mein hain. Har box ek chhota number hold karta hai. Har box par ek permanent house-number paint kiya hua hai.
Figure mein drawn ek subtle lekin vital point: consecutive addresses physically side by side hote hain. Address 0x1004 bilkul 0x1000 ke daayein wala box hai. "Number mein close" ka matlab hai space mein close. Yeh yaad rakho — yeh spatial locality ka poora engine hai.
Recall
Ek memory location vs. ek address ::: Location woh box hai (physical slot); address uس par paint kiya hua number hai.
Parent ek program ki baat karta hai jo accesses ki ek sequence karta hai. Ek stream of tickets imagine karo, ek per access, har ek par us address ka stamp jise touch kiya gaya:
Parent note locality ke har flavour ko ek tiny formula mein squeeze karta hai. Har formula list A1,A2,… ke baare mein ek sawaal hai. Pehle arithmetic earn karte hain.
Topic ko yeh kyun chahiye? Do consecutive addresses ke beech ki doori measure karne ke liye:
Stride=∣Ai+1−Ai∣
Yahan Ai+1−Ai hai "agla box number minus yeh box number." Agar program aage step kiya to difference positive hai; agar woh peeche jump kiya to negative hai. Hum sirf jump kitna bada tha care karte hain, uski direction nahi — isliye hum ise ∣⋅∣ mein wrap karte hain.
Recall
Stride formula mein absolute value kyun ::: Ek backward step (Ai+1<Ai) ek negative difference deta hai, lekin hum sirf distance care karte hain jump ki, isliye hum sign strip karte hain.
Topic is counting job ko ek naam se likhta hai; "do markers ke beech unique items count karo" ki machinery wahi hai jo parent ke formula ka matlab hai. Koi naya symbol nahi — bas word "count."
Jab yeh foundations in place ho jaayein to tum Cache organization fundamentals aur Cache mapping strategies (shelf kaise arrange hai) ke liye ready ho, Working set model (use mein chhote portion ko formalise karna), aur Loop blocking and tiling (bad-stride matrix case fix karna). Baad mein, Virtual memory locality ko ek coarser page grain par reuse karta hai.