Common Language Infrastructure
Common Language Infrastructure (CLI) provides a language-neutral platform for application development and execution, including functions for exception handling, garbage collection, security, and interoperability.
Common Language Infrastructure (CLI) enables an application program written in any of several commonly-used programming languages to be run on any operating system using a common runtime program rather than a language-specific one.
CLI and Java use a compiler to process language statements (also known as source code) into a preliminary form of executable code called bytecode. Later, when a program is run, its bytecode is compiled into the native code required by the machine architecture of a given computer.
.NET
Runtime (Common Language Runtime - CLR)
1. Common Language Runtime (CLR):
-
Purpose: The CLR is the heart of the .NET runtime. It provides a managed
execution environment for .NET applications, offering a range of services that
are essential for running and managing code.
- Key Services:
- Memory Management: Automatically handles
the allocation and release of memory, which helps prevent memory leaks and
other issues associated with manual memory management.
- Garbage Collection: Automatically
identifies and reclaims memory that is no longer in use, freeing up resources
and reducing the risk of memory leaks.
- Exception Handling: Provides a structured
way to handle errors and exceptions that occur during the execution of a
program, ensuring that applications can gracefully recover from unexpected
issues.
- Security: Enforces code access security
policies, which restrict or permit code from performing certain operations
based on its trust level.
- Type Safety: Ensures that code is executed
safely and correctly by enforcing type constraints and providing a level of
abstraction between the code and the hardware.
2. Just-In-Time (JIT) Compiler:
-
Purpose: The JIT compiler converts Intermediate Language (IL) code into native
machine code at runtime, allowing .NET applications to run efficiently on
different hardware platforms.
-
How It Works: When a .NET application is executed, the CLR first compiles the
IL code into native code specific to the hardware and operating system. This
native code is then executed by the CPU. The JIT compilation happens just
before the code is executed, which allows optimizations based on runtime
information.
2. Base
Class Library (BCL)
Overview:
-
The BCL is a comprehensive library of pre-built classes, interfaces, and value
types that provide fundamental functionalities needed for developing .NET
applications. It acts as a foundational layer upon which developers build their
applications.
Key
Features:
-
System Collections: Includes collections such as lists, dictionaries, and
queues that simplify the management of groups of related objects.
-
File I/O: Provides classes for reading from and writing to files and streams,
managing file system operations, and handling directories.
-
Networking: Offers classes for handling network communications, including HTTP
requests, sockets, and network protocols.
-
Data Access: Includes classes for accessing and manipulating data, such as SQL
Server databases or other data sources. This includes components like ADO.NET
and Entity Framework.
-
Security: Contains classes for implementing cryptographic operations, managing
permissions, and handling security-related tasks.
-
Threading: Provides support for creating and managing threads, handling
asynchronous operations, and working with synchronization primitives.
3. .NET Core
/ .NET 5+
.NET Core:
-
Overview: .NET Core is the cross-platform, open-source version of the .NET
framework that was designed to run on various operating systems, including
Windows, macOS, and Linux. It offers a modern and modular approach to
application development.
- Key Features:
- Cross-Platform: Allows for the development
of applications that can run on multiple operating systems.
- Performance: Optimized for high performance
and scalability, making it suitable for modern cloud-based and microservices
architectures.
- Modularity: Uses a modular architecture
with NuGet packages, so you can include only the components you need, reducing
the application footprint.
- Command-Line Interface (CLI): Provides a
CLI for creating, building, running, and publishing .NET applications,
facilitating automation and cross-platform development.
No comments:
Post a Comment