The Common Language Runtime (CLR)

CLR वह engine है जिसके अंदर हर .NET program run होता है: यह assemblies load करता है, MSIL verify करता है, JIT-compile करता है, garbage collect करता है, security enforce करता है और exceptions channel करता है, हर language के लिए एक साथ।

9 min read · 9 cards · 2 checks

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


Theory

वह Invisible Supervisor

लगातार दो lessons same doorstep पर खत्म हुए हैं: कुछ assembly load करता है, कुछ JIT run करता है, कुछ garbage collect करता है। उस कुछ को name और tour करने का time है।

Common Language Runtime .NET का वह हिस्सा है जो ShopKeeper के Mehta Stores में run होने के दौरान असल में PRESENT है: आपका code कभी अकेले execute नहीं होता, यह CLR के अंदर execute होता है, exactly जैसे BCA403 का एक program JVM के अंदर execute होता था।

Supervisor दिन भर exactly क्या करता है? Six jobs।

Theory

Control Tower

एक airport tower planes नहीं उड़ाता। यह हर एक को takeoff के लिए clear करता है (verification), runways assign करता है (memory), हर movement watch करता है (execution management), emergencies को procedure से handle करता है (exceptions), और हर airline को alike treat करता है: Air India या Indigo, same rules।

CLR वह tower है। VB.NET planes, C# planes: एक बार MSIL बन जाने पर, tower बता भी नहीं सकता किस language ने उन्हें बनाया, और सबको identically supervise करता है। यही वह word common है जो अपना काम कर रहा है।

Theory

CLR की 6 Services

इन्हें एक list की तरह सीखिए; exams exactly यही पूछते हैं:

  • Loading: program को ज़रूरत होने पर assemblies ढूँढता और load करता है
  • Verification: MSIL को run करने से PEHLE type safety के लिए check करता है (कोई stray memory tricks sneak नहीं करते)
  • JIT Compilation: MSIL से native, method by method (पिछला lesson)
  • Garbage Collection: automatic memory management
  • Security: enforce करता है loaded code को क्या allow है
  • Exception Handling: सारी languages में एक structured crash-handling system, Unit 3 के Try/Catch के नीचे की machinery

At a glance

CLR Service, और ShopKeeper को इससे क्या मिलता है

ServiceShopKeeper को क्या मिलता है
Loadingइसकी assemblies demand पर found और brought in
VerificationCorrupt या unsafe MSIL run होने से पहले refused
JITTill के जो भी CPU पर native speed
Garbage Collectionभूली हुई cleanup से कोई memory leaks नहीं
SecurityDownloaded plugins disk wipe नहीं कर सकते
Exception HandlingPrice में एक typo एक message box crash करता है, till नहीं

Quiz

Runtime को COMMON Language Runtime क्यों कहा जाता है?

  1. क्योंकि यह सबसे commonly installed Microsoft product है
  2. क्योंकि हर .NET language का code इस एक shared runtime पर run होता है
  3. क्योंकि यह सिर्फ़ commonly इस्तेमाल किए, pre-approved programs run करता है
  4. क्योंकि यह Windows और Java programs के बीच shared है
Show the answer

क्योंकि हर .NET language का code इस एक shared runtime पर run होता है

Common का मतलब है LANGUAGES के आर-पार shared: VB.NET, C# और F# सब MSIL में compile होते हैं, और CLR result को identically supervise करता है, CTS के shared type system से aided। MSIL stage तक, runtime बता नहीं सकता किस language ने code लिखा। Option A popularity को name समझ लेता है। Option C एक approval process invent करता है। Option D बहुत ज़्यादा stretch करता है: Java JVM पर run होता है; 2 runtimes parallel designs हैं, shared infrastructure नहीं।

Think first

Verification कहाँ अपनी Keep Earn करता है

CLR MSIL को run करने से पहले verify करता है। BCA104 के C के बारे में सोचिए, जहाँ एक program किसी भी pointer से किसी भी address पर लिख सकता था। Verification किस class के disaster का door बंद कर रहा है?

Show the answer

Memory corruption और इसके exploits। C में, एक stray या malicious pointer दूसरे variables, दूसरे programs का data overwrite कर सकता था, code inject भी कर सकता था: crashes at best, viruses at worst। Verification prove करता है MSIL सिर्फ़ उन types और memory को touch करता है जिनका यह legitimately owner है, एक भी instruction run होने से PEHLE; unverifiable code refuse कर दिया जाता है। Managed VB.NET में raw pointers न होने के साथ combined, BCA104-era bugs की पूरी categories यहाँ simply impossible हैं, BCA403 में Java ने जो same safety pitch दिया।

Watch out

Boxes को Straight रखिए

CLR बनाम JIT: JIT CLR के INSIDE एक component है, इसका synonym नहीं। "JIT memory manage करता है" दो बार ग़लत है।

CLR बनाम Class Library: CLR engine है; library parts है। Engine code run करता है; यह TextBox provide नहीं करता।

CLR बनाम CTS/CLS: CTS shared type rulebook है, CLS interop guidelines हैं; CLR वह running software है जो rules enforce करता है।

Theory

Same Exam, दो Vocabularies

यह lesson BCA403 के JVM lesson के बगल में रखिए और parallel लगभग line for line है: load, verify, JIT, garbage collect। Compare करने के लिए पूछे जाने पर लिखने लायक दो honest differences: CLR पहले दिन से MANY languages के लिए design किया गया था (JVM originally Java के लिए अकेले), और classic .NET ने एक OS target किया जबकि Java ने कई। Engine tour होने के साथ, अगला lesson दूसरा pillar खोलता है: वह class library जिससे ShopKeeper assemble होगा।

Summary

Key takeaways

  • CLR .NET का execution engine है: हर managed program इसके अंदर run होता है।
  • 6 services: loading, MSIL verification, JIT compilation, garbage collection, security, exception handling।
  • Common = सारी .NET languages के लिए एक runtime; MSIL level पर language disappear हो जाती है।
  • Verification execution से पहले type safety check करता है: unsafe code refuse होता है, crash नहीं।
  • JIT और GC CLR के अंदर components हैं, इसके alternatives नहीं।
  • CLR : .NET :: JVM : Java, .NET के day-1 difference की तरह multi-language support के साथ।
  • Memory hook: control tower कुछ नहीं उड़ाता, सब कुछ supervise करता है।

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 Overview of Microsoft .NET Framework

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

The Common Language Runtime (CLR) · .NET Programming · Gri-Learn