Substrate VM. Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Similar documents
Truffle A language implementation framework

Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Safe Harbor Statement

SUPPORTING NATIVE PTHREADS IN SYSCALL EMULATION MODE BRANDON POTTER JUNE 14 TH, 2015

Threads. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Chapter 4 Threads. Images from Silberschatz 03/12/18. CS460 Pacific University 1

THREADS. Jo, Heeseung

CS Lecture 3! Threads! George Mason University! Spring 2010!

Ahead of Time (AOT) Compilation

JRuby+Truffle. Kevin Menard. Chris Seaton. Benoit Daloze. A tour through a new Ruby Oracle Oracle Labs

Computer Systems Laboratory Sungkyunkwan University

Concurrent Programming

Concurrent Programming

Concurrent Programming

Last class: Today: Thread Background. Thread Systems

Introduction to pthreads

Concurrent Programming

POSIX PTHREADS PROGRAMMING

Introduction to PThreads and Basic Synchronization

Computer Systems Laboratory Sungkyunkwan University

Programming RT systems with pthreads

Threads need to synchronize their activities to effectively interact. This includes:

Modern Stored Procedures Using GraalVM

Pthreads. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Total Score is updated. The score of PA4 will be changed! Please check it. Will be changed

OS Abstractor with POSIX

More Shared Memory Programming

CS 105, Spring 2007 Ring Buffer

Posix Threads (Pthreads)

COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads. Zhi Wang Florida State University

JDK 9/10/11 and Garbage Collection

pthreads CS449 Fall 2017

Threads. Jo, Heeseung

TCSS 422: OPERATING SYSTEMS

C Grundlagen - Threads

11/04/2018. Outline. Process. Process. Pthread Library. Process and threads

Concurrent Programming is Hard! Concurrent Programming. Reminder: Iterative Echo Server. The human mind tends to be sequential

CS444 1/28/05. Lab 03

Threads. Jo, Heeseung

Threads. CS 475, Spring 2018 Concurrent & Distributed Systems

Oracle R Technologies

ANSI/IEEE POSIX Standard Thread management

CSCI 4500/8506 Operating Systems Some UNIX System Calls, Library, and PThreads Functions

Concurrent Programming

Thread and Synchronization

OPERATING SYSTEM. Chapter 4: Threads

Thread. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Synchronising Threads

I/O and Syscalls in Critical Sections and their Implications for Transactional Memory

Lecture 1: Overview of Java

Oracle Developer Studio Performance Analyzer

2018/10/29 22:25 1/5 Linux Processes vs NuttX Tasks

LSN 13 Linux Concurrency Mechanisms

Agenda. Process vs Thread. ! POSIX Threads Programming. Picture source:

The course that gives CMU its Zip! Concurrency I: Threads April 10, 2001

pthreads Announcement Reminder: SMP1 due today Reminder: Please keep up with the reading assignments (see class webpage)

Welcome to the session...

Oracle Berkeley DB. Porting Guide. 12c Release 1

Low-Level C Programming. Memory map Pointers Arrays Structures

Approaches to Concurrency

Threading Language and Support. CS528 Multithreading: Programming with Threads. Programming with Threads

COSC 6374 Parallel Computation. Shared memory programming with POSIX Threads. Edgar Gabriel. Fall References

CSci 4061 Introduction to Operating Systems. (Threads-POSIX)

Programming RT systems with pthreads

Concurrent Programming. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

4. Concurrency via Threads

Threads (SGG 4) Outline. Traditional Process: Single Activity. Example: A Text Editor with Multi-Activity. Instructor: Dr.

Programming with Shared Memory. Nguyễn Quang Hùng

COP 4610: Introduction to Operating Systems (Fall 2016) Chapter 4: Threads. Zhi Wang Florida State University

Pthreads Library Interface. Frank Mueller. Florida State University. phone: (904) , July 22, 1993.

High-level Synchronization

CPSC 313: Intro to Computer Systems. POSIX Threads. Latency Hiding / Multiprogramming (covered earlier) Ease of Programming (covered now)

POSIX Threads. HUJI Spring 2011

CS 105, Spring 2015 Ring Buffer

Java in a World of Containers

COMP 3430 Robert Guderian

Last week. Data on the stack is allocated automatically when we do a function call, and removed when we return

CSE 333 SECTION 9. Threads

Lw and ULw POSIX AEPs for Resource Constrained Processors. Document WINNF-14-S-0009

The Z Garbage Collector Low Latency GC for OpenJDK

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

PARALLEL PROGRAMMING ON MULTICORES Threading Subroutines

Multithreading Programming II

Pthreads (2) Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

CSCE 313: Intro to Computer Systems

Memory management. Johan Montelius KTH

Pre-lab #2 tutorial. ECE 254 Operating Systems and Systems Programming. May 24, 2012

Programming Language Concepts Scoping. Janyl Jumadinova January 31, 2017

EPL372 Lab Exercise 2: Threads and pthreads. Εργαστήριο 2. Πέτρος Παναγή

Carnegie Mellon Performance of Mul.threaded Code

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

CSC 1600 Memory Layout for Unix Processes"

CS 3723 Operating Systems: Final Review

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

The Z Garbage Collector Scalable Low-Latency GC in JDK 11

Running class Timing on Java HotSpot VM, 1

The Z Garbage Collector An Introduction

Concurrency, Thread. Dongkun Shin, SKKU

CSCE 313 Introduction to Computer Systems. Instructor: Dr. Dezhen Song

Transcription:

Substrate VM 1

Safe Harbor Statement The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described in connection with any Oracle product or service remains at the sole discretion of Oracle. Any views expressed in this presentation are my own and do not necessarily reflect the views of Oracle. 2

GraalVM Stack TruffleRuby logo Copyright (C) 2017 Talkdesk, Inc. Licensed under CC BY 4.0: https://creativecommons.org/licenses/by/4.0/ The R logo is Copyright (C) 2016 The R Foundation. Licensed under CC BY SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/ 3

GraalVM Stack Substrate VM TruffleRuby logo Copyright (C) 2017 Talkdesk, Inc. Licensed under CC BY 4.0: https://creativecommons.org/licenses/by/4.0/ The R logo is Copyright (C) 2016 The R Foundation. Licensed under CC BY SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/ 3

Substrate VM is an embeddable VM with fast startup and low footprint for, and written in, a subset of Java optimized to execute Truffle languages ahead-of-time compiled using Graal integrating with native development tools. 4

Substrate VM: Execution Model Points-To Analysis Ahead-of-Time Compilation Truffle Language JDK Substrate VM Machine Code Initial Heap DWARF Info ELF / MachO Binary All Java classes from Truffle language (or any application), JDK, and Substrate VM Reachable methods, fields, and classes Application running without dependency on JDK and without Java class loading 5

Features of Substrate VM Type safety and memory safety of Java Type checks, array bounds checks, null pointer checks Garbage collection All Java memory is managed automatically JDK support Most core and utility classes C code integration SystemJava: access C functions and C data structures without performance overhead Multithreading (optional feature) Everything in java.util.concurrent package Native tool support for debugging, profiling,... Standard DWARF debug information for ahead-of-time compiled code and dynamically compiled code 6

"Hello World" in C, Java, Ruby Language Virtual Machine Instructions Time C hello 147,000 < 1 ms puts("hello!"); Java Java HotSpot VM 1.8.0_121-b13 140,000,000 50 ms System.out.println("Hello! ") Java GraalVM 0.21 Substrate VM 332,000 < 1 ms System.out.println("Hello! ") Ruby MRI 2.3.3p222 125,000,000 35 ms ruby -e 'puts "Hello!"' Ruby GraalVM 0.21 truffleruby 40,754,085,818 4955 ms ruby -e 'puts "Hello!"' Ruby GraalVM 0.21 Substrate VM truffleruby image 345,160,332 90 ms ruby -e 'puts "Hello!"' Operating system: Linux x86_64 Instructions: perf stat -e instructions... Time: time (bash builtin)... Substrate VM gets Ruby startup close to MRI 7

SystemJava: Integrate Java and C Code @CFunction static native int clock_gettime(int clock_id, timespec tp); @CConstant static native int CLOCK_MONOTONIC(); @CStruct interface timespec extends PointerBase { @CField long tv_sec(); @CField long tv_nsec(); } @CPointerTo(nameOfCType="int") interface CIntPointer extends PointerBase { int read(); void write(int value); } @CPointerTo(CIntPointer.class) interface CIntPointerPointer... int clock_gettime(clockid_t clock_id, struct timespec * tp) #define CLOCK_MONOTONIC 1 struct timespec { time_t tv_sec; syscall_slong_t tv_nsec; }; int* pint; int** ppint; Implementation of System.nanoTime() using SystemJava: static long nanotime() { timespec tp = StackValue.get(SizeOf.get(timespec.class)); clock_gettime(clock_monotonic(), tp); return tp.tv_sec() * 1_000_000_000L + tp.tv_nsec(); } 8

Dependencies Standard C library Allocate and free memory Low-level file access Optional: pthread No dependency on Signal handling Memory protection Standard C++ library Any Java virtual machine, Java bytecodes Any native library of the JDK Example: all dependencies of the JavaScript executable Memory mapping mmap64, munmap C Memory allocation malloc, calloc, free Core library memmove, exit, gettimeofday, clock_gettime, strerror, errno_location, getuid, getpwuid, sysconf File access open, close, read, write, pread64, opendir, closedir, readdir64_r, lseek, realpath, getcwd, dup2, fsync, ioctl, fcntl, unlink, xstat64, fxstat64 Thread pthread_create, pthread_join, sched_yield, pthread_key_create, pthread_mutex_init, pthread_cond_init, pthread_mutex_lock, pthread_mutex_unlock, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_getspecific, pthread_setspecific, pthread_cancel, pthread_testcancel, pthread_attr_init, pthread_attr_setguardsize, pthread_attr_setstacksize, pthread_attr_destroy 9

Try It Yourself: http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html 10

11