SlideShare a Scribd company logo
From ‘dotnet run’
to “Hello World”
@matthewwarren
mattwarren.org
From ‘dotnet run’
to “Hello World”
http://raygun.com/apm
I ❤ ‘.NET Internals’
Understand one level below
your usual abstraction
Neal Ford
Demo – “Hello World”
Outline
• Main Components
• Hosting the runtime
• CLR Initialisation
• Type Loader
• JIT Compilation
• Everything Else
Main Components
CoreCLR Repository
• 2.6 million of source code, under src
• 8.2 million lines of test code
• 24,485 Files (7,466 source & 17,019 test)
– 6,626 C# (956 source & 5,670 test)
– 2,074 C and C++
– 3,701 IL
– 93 Assembler, 43 Python & 6 Perl!!
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
Virtual Machine (VM)
• Type System, Generics
• Built-in Types
• Loading types/classes
• Threading
• Exception Handling and Stack Walking
• Event Tracing and Profiling
• P/Invoke
Hosting
Hosting API
1. Identify the managed entry point
2. Find and load CoreCLR.dll
3. Get an ICLRRuntimeHost2 Instance
4. Set start-up flags and start the runtime
5. Preparing AppDomain settings
6. Create the AppDomain
7. Run managed code
8. Clean up
https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting
Demo – Hosting API
Initialisation
Initialising the CLR
• Phase 1 - Set-up infrastructure for all components
• Phase 2 - Initialise the core, low-level components
• Phase 3 - Start-up the low-level components, i.e. error
handling, profiling API, debugging
• Phase 4 - Start the main components, i.e. GC & AppDomains
• Phase 5 - Final setup and send out a notification
http://mattwarren.org/2017/02/07/The-68-things-the-CLR-does-before-
executing-a-single-line-of-your-code/
Demo - PerfView
ImageCourtesyof
JuliaEvans
@b0rk–jvns.ca
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals
Type Loader
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
http://mattwarren.org/2017/06/15/How-the-.NET-Rutime-loads-a-Type/
JIT Compilation
http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-
method-and-Tiered-Compilation/
Before JIT-ing
http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-
method-and-Tiered-Compilation/
Before JIT-ing
After JIT-ing
http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-
method-and-Tiered-Compilation/
Before JIT-ing
After JIT-ing with ‘Tiered Compilation’
http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-
method-and-Tiered-Compilation/
After JIT-ing with ‘Tiered Compilation’ - Optimised
Everything Else
Marshalling and P/Invoke
Resources
• http://mattwarren.org/tags/#Internals
– Resources for Learning about .NET Internals
– Exploring the Internals of the .NET Runtime
– Tools for Exploring .NET Internals
– Presentations and Talks covering '.NET Internals'
• Book of the Runtime (BotR)
– https://github.com/dotnet/coreclr/tree/master/Document
ation/botr
I ❤ ‘.NET Internals’
AMA

More Related Content

PPTX
CSVファイルをLODとして公開するデータソン
PDF
5分でわかるクリーンアーキテクチャ
PPTX
Glue DataBrewでデータをクリーニング、加工してみよう
PDF
浮動小数点(IEEE754)を圧縮したい@dsirnlp#4
PPTX
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)
PDF
[Container Runtime Meetup] runc & User Namespaces
PDF
OpenShiftでJBoss EAP構築
PPTX
ぱぱっと理解するSpring Cloudの基本
CSVファイルをLODとして公開するデータソン
5分でわかるクリーンアーキテクチャ
Glue DataBrewでデータをクリーニング、加工してみよう
浮動小数点(IEEE754)を圧縮したい@dsirnlp#4
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)
[Container Runtime Meetup] runc & User Namespaces
OpenShiftでJBoss EAP構築
ぱぱっと理解するSpring Cloudの基本

What's hot (20)

PDF
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
PPTX
オープンデータをLOD化するデータソン in 高槻
PDF
Implementing Microservices Security Patterns & Protocols with Spring
PPTX
.NET Conf 2018 - Message Queue Based RPC
PDF
2日間Fabricを触った俺が
 色々解説してみる
PDF
traitを使って楽したい話
PDF
XAML入門
PDF
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
PDF
Wireshark だけに頼らない! パケット解析ツールの紹介
PDF
わかった気になるMySQL
ODP
Format string Attack
PPTX
OpenStackで始めるクラウド環境構築入門
PDF
Form認証で学ぶSpring Security入門
PPTX
Spring Framework 4.3から5.0へ
PDF
WPF4.5入門
PPTX
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -
PDF
オブジェクト指向の設計と実装の学び方のコツ
PDF
RISC-Vのセキュリティ技術(TEE, Root of Trust, Remote Attestation)
PDF
systemd 再入門
PDF
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
オープンデータをLOD化するデータソン in 高槻
Implementing Microservices Security Patterns & Protocols with Spring
.NET Conf 2018 - Message Queue Based RPC
2日間Fabricを触った俺が
 色々解説してみる
traitを使って楽したい話
XAML入門
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
Wireshark だけに頼らない! パケット解析ツールの紹介
わかった気になるMySQL
Format string Attack
OpenStackで始めるクラウド環境構築入門
Form認証で学ぶSpring Security入門
Spring Framework 4.3から5.0へ
WPF4.5入門
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -
オブジェクト指向の設計と実装の学び方のコツ
RISC-Vのセキュリティ技術(TEE, Root of Trust, Remote Attestation)
systemd 再入門
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Ad

Similar to From 'dotnet run' to 'hello world' (20)

PDF
From 'dotnet run' to 'hello world'
PDF
Raffaele Rialdi
PDF
Building High Performance Android Applications in Java and C++
PPTX
Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...
PDF
Mastering Terraform and the Provider for OCI
PDF
MattsonTutorialSC14.pdf
PPTX
Practical Windows Kernel Exploitation
PPTX
Indic threads pune12-accelerating computation in html 5
PDF
Tips and tricks for building high performance android apps using native code
PDF
DEF CON 27 - JESSE MICHAEL - get off the kernel if you can't drive
PPTX
MattsonTutorialSC14.pptx
PDF
Windows内核技术介绍
PPTX
C++ in kernel mode
PDF
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
PDF
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PPTX
Inside CoreCLR
PPTX
OrigoDB - take the red pill
PPTX
Defending Your "Gold"
PPTX
06.1 .Net memory management
PDF
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
From 'dotnet run' to 'hello world'
Raffaele Rialdi
Building High Performance Android Applications in Java and C++
Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...
Mastering Terraform and the Provider for OCI
MattsonTutorialSC14.pdf
Practical Windows Kernel Exploitation
Indic threads pune12-accelerating computation in html 5
Tips and tricks for building high performance android apps using native code
DEF CON 27 - JESSE MICHAEL - get off the kernel if you can't drive
MattsonTutorialSC14.pptx
Windows内核技术介绍
C++ in kernel mode
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
Inside CoreCLR
OrigoDB - take the red pill
Defending Your "Gold"
06.1 .Net memory management
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
Ad

More from Matt Warren (8)

PPTX
Microsoft & open source a 'brave new world' - CORESTART 2.0
PPTX
Microsoft & Open Source - a 'brave new world' - ProgSCon 2017
PPTX
Where the wild things are - Benchmarking and Micro-Optimisations
PPTX
Performance is a Feature! at DDD 11
PPTX
Performance and how to measure it - ProgSCon London 2016
PPTX
Performance is a feature! - London .NET User Group
PPTX
Performance is a feature! - Developer South Coast - part 2
PPTX
Performance is a feature! - Developer South Coast - part 1
Microsoft & open source a 'brave new world' - CORESTART 2.0
Microsoft & Open Source - a 'brave new world' - ProgSCon 2017
Where the wild things are - Benchmarking and Micro-Optimisations
Performance is a Feature! at DDD 11
Performance and how to measure it - ProgSCon London 2016
Performance is a feature! - London .NET User Group
Performance is a feature! - Developer South Coast - part 2
Performance is a feature! - Developer South Coast - part 1

Recently uploaded (20)

PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Transform Your Business with a Software ERP System
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
medical staffing services at VALiNTRY
PPTX
Introduction to Artificial Intelligence
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Digital Systems & Binary Numbers (comprehensive )
PTS Company Brochure 2025 (1).pdf.......
Transform Your Business with a Software ERP System
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
medical staffing services at VALiNTRY
Introduction to Artificial Intelligence
L1 - Introduction to python Backend.pptx
Odoo POS Development Services by CandidRoot Solutions
Navsoft: AI-Powered Business Solutions & Custom Software Development
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx

From 'dotnet run' to 'hello world'

Editor's Notes

  • #5: We’re Engineers, we love knowing what’s going on ‘under the hood’ Helps with Perf (Ben Adams, Kestrel, TechEmpower, deep JIT knowledge) As a community we should understand our ecosystem
  • #10: mscorlib is now System.Private.CoreLib
  • #11: mscorlib is now System.Private.CoreLib
  • #12: mscorlib is now System.Private.CoreLib
  • #13: mscorlib is now System.Private.CoreLib
  • #14: mscorlib is now System.Private.CoreLib
  • #15: mscorlib is now System.Private.CoreLib
  • #16: mscorlib is now System.Private.CoreLib
  • #17: mscorlib is now System.Private.CoreLib
  • #23: Phase 1 – Config, ThreadManager, ETW Events, Diagnostics & Perf logs Phase 2 – Assembly Binding (aka “Fusion”), Perf Counters, Stub Manager, Debugger Manager Phase 3 – Also initial runtime thread is started Phase 4 – Code Access Security (CAS), Stack Probes, Phase 5 - Set-up all the shared static variables
  • #32: Partially filled in ‘data structures’ More data is added at each step A class can only progress through the steps if it’s dependencies also progress