Memory Management Units, Physical and Logical Memory

एक Memory Management Unit एक programmer के काल्पनिक address space को असली physical RAM स्थानों से map करता है।

10 min read · 9 cards · 2 checks

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


Theory

Classroom Bench की गड़बड़ी

कल्पना कीजिए आपके professor आपको Roll Number 5 देते हैं और LabOne server room में Seat 5 पर बैठने को कहते हैं। पर जब आप पहुँचते हैं, पहली 10 benches टूटी हुई हैं, तो lab technician सबको 10 seats नीचे खिसका देता है। आपका दिमाग़ अब भी सोचता है कि आप position 5 पर हैं, पर आपका असल physical शरीर Seat 15 पर टिका है। अगर आपका program मानता है कि उसके पास एक ख़ास memory spot है, क्या होता है जब 30 students एक साथ उसी RAM chip में code load करें?

Theory

Mall Directory Map

logical addresses को एक मानक retail outlet chain के भीतरी blueprint की तरह सोचिए। आप चाहे किसी भी शहर में जाएँ, stock room हमेशा पीछे होता है, और cash counter सामने। यह आपका सुसंगत local layout है। पर physical address उस ख़ास दुकान के एक शहर के mall के अंदर असली global GPS coordinates हैं। shopping mall directory एक तत्काल अनुवादक के रूप में काम करती है, आपके local layout query को एक असली physical floor स्थान से map करते हुए।

Theory

Logical बनाम Physical Address Space

compilation के दौरान, CPU शून्य से शुरू होते reference locations generate करता है, जिन्हें एक logical address कहा जाता है। इन positions का पूरा संग्रह logical address space है। पर, असली hardware RAM chips में raw storage slots होते हैं जिन्हें एक physical address कहा जाता है। software कभी raw physical RAM से सीधे बातचीत नहीं करता। बजाय इसके, एक समर्पित hardware circuit जिसे Memory Management Unit (MMU) कहा जाता है, हर काल्पनिक logical address को बिजली की गति से एक असली physical coordinate में अनुवादित करता है।

At a glance

logical और physical memory addressing के बीच मुख्य संरचनात्मक अंतर।

FeatureLogical AddressPhysical Address
किससे Generate होता हैprogram execution के दौरान CPUhardware MMU chip mapping
दृश्यताUser program इसे देख और संशोधित कर सकता हैUser programs से पूरी तरह छुपा
Base Valueहर process के लिए हमेशा शून्य से शुरू होता हैRAM में उपलब्ध मुफ़्त blocks पर निर्भर करता है
वैकल्पिक नामVirtual AddressReal Address

Think first

असली RAM Address की गणना

मान लीजिए student1 LabOne पर एक program load करता है। CPU 342 का एक logical address generate करता है। MMU में एक base relocation register 20000 पर set है। गणना कीजिए कि यह data RAM में किस बिल्कुल physical address पर store होगा। जवाब प्रकट करने से पहले addition के चरण मन में सोचिए।

Show the answer

Step 1: दिए गए मान पहचानिए। Logical Address = 342. Base Relocation Register = 20000.

Step 2: MMU translation formula लागू कीजिए: Physical Address = Logical Address + Relocation Register.

Step 3: संख्याएँ रखिए: Physical Address = 342 + 20000 = 20342.

Step 4: MMU hardware physical RAM से byte लाने के लिए address bus पर 20342 का binary समकक्ष भेजता है।

Quiz

अगर LabOne पर एक user program crash हो जाए और memory address 0x0045 दिखाता एक segmentation fault error print करे, programmer किस प्रकार के address को देख रहा है?

  1. एक physical address जो सीधे एक hardware transistor block की ओर इशारा करता है
  2. उस अलग process के लिए CPU द्वारा generate किया गया एक logical address
  3. motherboard central power supply unit के अंदर एक core address
  4. local printer driver द्वारा generate किया गया एक physical layout map index
Show the answer

उस अलग process के लिए CPU द्वारा generate किया गया एक logical address

User programs हमेशा सिर्फ़ logical addresses देखते और print करते हैं। operating system और hardware MMU security बनाए रखने के लिए physical addresses को सावधानी से छुपाते हैं, user programs को दूसरे students के असली hardware blocks पढ़ने या भ्रष्ट करने से रोकते हुए।

Watch out

Relocation Register Addition की ग़लती

एक classic university exam जाल यह भूलना है कि relocation register value physical memory के परम शुरुआती block को दर्शाती है। students कभी-कभी logical address घटाते हैं या translation सवालों के दौरान मानों को गुणा करने की कोशिश करते हैं। याद रखिए, logical address बस एक offset है: शुरुआती line से एक entry दूरी। अंतिम physical गंतव्य खोजने के लिए हमेशा logical offset को base register में जोड़िए।

Theory

यह Semester 3 के लिए क्यों मायने रखता है

यह address अलगाव आधुनिक computing systems की गुप्त ढाल है। Semester 3 में, जब आप advanced security और Android application frameworks पढ़ते हैं, आप जानेंगे कि यह बिल्कुल MMU mapping एक दुर्भावनापूर्ण download किए game को आपके banking application data में ताक-झाँक करने से रोकता है। क्योंकि हर app का अपना अलग logical address space शून्य से शुरू होता है, यह किसी दूसरे app के memory space को reference नहीं कर सकता।

Summary

Key takeaways

  • Logical addresses CPU द्वारा generate होते हैं और individual program सरलता के लिए हमेशा शून्य से शुरू होते हैं।
  • Physical addresses physical RAM memory chips पर असली electrical slots से मेल खाते हैं।
  • Memory Management Unit real time address translation के लिए ज़िम्मेदार hardware घटक है।
  • base relocation register OS द्वारा एक program को allocate किया गया शुरुआती physical address store करता है।
  • याद रखने का formula: Physical Address बराबर Logical Address जमा Relocation Value।
  • Memory hook: Logical conceptual है, Physical actual है, MMU factual map करता है!

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 File and Memory Management

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

Memory Management Units, Physical and Logical Memory · Operating System · Gri-Learn