Slide 1

Slide 1 text

Managed Runtime Systems Introduction Foivos Zakkak https://foivos.zakkak.net Except where otherwise noted, this presentation is licensed under the Creative Commons Attribution 4.0 International License. Third party marks and brands are the property of their respective holders.

Slide 2

Slide 2 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 2 What is a Managed Runtime System? A machine that executes managed programs Managed Runtime System / Virtual Machine x86 ARMv8 RISC-V ... HW GNU/Linux OSX Windows ... OS Program (Java, Python, etc.)

Slide 3

Slide 3 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 3 Other Names for Managed Runtime Systems ■ Managed Runtime Systems ■ Managed Runtimes ■ Virtual Machines ■ Process Virtual Machines ■ Language Virtual Machines

Slide 4

Slide 4 text

Why Managed Languages and Runtime Systems?

Slide 5

Slide 5 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 5 Why Managed Languages and Runtime Systems? 1. Portability 2. Safety 3. Productivity 4. Debugging 5. Performance 6. Snapshots

Slide 6

Slide 6 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 6 Portability: “Write once, run anywhere” (aka WORA) ■ Binary distribution ■ Consistent behavior ■ No need to recompile ■ No need to account for OS differences ■ No need to account for hardware differences

Slide 7

Slide 7 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 7 Safety ■ Sandboxed environment ■ No pointer arithmetic ■ No arbitrary memory accesses ■ No arbitrary code flow

Slide 8

Slide 8 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 8 Productivity ■ Feature-full standard libraries (no need to reinvent the wheel) ■ No need to account for OS differences ■ No need to account for hardware differences/details

Slide 9

Slide 9 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 9 Debugging ■ No need to recompile ■ On the fly instrumentation of production code ■ Observation of system state

Slide 10

Slide 10 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 10 Performance (some times) ■ Dynamic code profiling ■ On the fly optimization

Slide 11

Slide 11 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 11 Snapshots ■ Store state ■ Resume later ■ Resume elsewhere

Slide 12

Slide 12 text

How does it work?

Slide 13

Slide 13 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 13 How does it work? Interpreters Parse and execute instructions JIT compilers On the fly compilation to machine code Garbage Collectors Automatic memory management Memory Models Define expected behavior

Slide 14

Slide 14 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 14 The most popular MRS/VMs Java  HotSpot  OpenJ9  Android Runtime JS  V8  SpiderMonkey  JavaScriptCore a.k.a. Nitro .Net (C#, J#, etc.)  Common Language Runtime a.k.a. CLR

Slide 15

Slide 15 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 15 Different Goals – Different Challenges Java & .Net  Server Applications  Desktop Applications  Mobile Applications JS  Web Back-end (e.g. nodeJS)  Web Front-end  Desktop Applications (e.g. Electron)

Slide 16

Slide 16 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 16 Server Applications Typical server applications: ■ High throughput ■ Low latency ■ Large heap ■ Responsiveness Micro-services: ■ Fast startup ■ Small heap ■ Responsiveness

Slide 17

Slide 17 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 17 Desktop Applications ■ Responsiveness ■ Fast startup

Slide 18

Slide 18 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 18 Mobile Applications ■ Responsiveness ■ Fast startup ■ Small memory footprint ■ Low energy consumption

Slide 19

Slide 19 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 19 Web Back-end ■ High throughput ■ Large heap ■ Responsiveness

Slide 20

Slide 20 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 20 Web Front-end ■ Responsiveness ■ Fast startup ■ Small memory footprint

Slide 21

Slide 21 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 21 Different Goals – Different Challenges Performance Orientation Memory Usage Energy Consumption Startup Time Desktop Apps Latency Medium Low Fast Mobile Apps Latency Low Low Fast Web Front-end Latency Low Low Fast Web Back-end Throughput High $ -- Server Apps Both High $ Fast for microservices

Slide 22

Slide 22 text

No VM to rule them all!!! Yet!?

Slide 23

Slide 23 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 23 Key features of a successful VM ■ Fast ■ Energy Efficient ■ Secure ■ Modular ■ Built-in Concurrency Support

Slide 24

Slide 24 text

Managed Runtime Systems CC-BY https://Foivos.Zakkak.net 24 Nice to have features ■ Maintainable ■ Polyglot!? ■ Fault tolerant ■ Support for accelerators/heterogeneous systems ■ Small memory footprint