Câu hỏi phỏng vấn .NET Core
Câu hỏi

What is JIT compiler?

Câu trả lời

A Just-In-Time (JIT) compiler is a component of the Common Language Runtime (CLR) in .NET that is responsible for converting the intermediate language code (such as Microsoft Intermediate Language (MSIL) or Common Intermediate Language (CIL)) into machine code that can be executed by the computer's processor. This process occurs at runtime, meaning the conversion happens just before the code is executed, rather than at the time of application deployment.

How JIT Compiler Works

  1. Intermediate Language Conversion: When a .NET application is executed, the JIT compiler converts the MSIL or CIL into native machine code on an as-needed basis. This means that only the code that is required for execution is compiled, which can save time and memory.
  2. Method Stubs: When a method is called for the first time, a stub passes control to the JIT compiler, which then compiles the method into native code and modifies the stub to point directly to the compiled code for subsequent calls[2].
  3. Caching: The compiled machine code is stored in memory so that it can be reused without recompilation when the method is called again[1][2].

Types of JIT Compilers

  1. Pre-JIT Compiler: Compiles the entire source code into machine code in a single cycle at the time of application deployment. This is implemented using the Native Image Generator (Ngen.exe)[1][3].
  2. Normal JIT Compiler: Compiles methods into machine code the first time they are called and stores them in cache for future use[1][3].
  3. Econo JIT Compiler: Compiles methods as needed at runtime and removes them when they are no longer required. This type of JIT compiler is obsolete starting from .NET 2.0[1][3].

Advantages of JIT Compilation

  • Memory Efficiency: Only the methods that are required at runtime ...
middle

middle

Gợi ý câu hỏi phỏng vấn

middle

What is Kestrel?

middle

When should we use .NET Core and .NET Standard Class Library project types?

middle

What is the correct pattern to implement long running background work in Asp.Net Core?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào