The Art of JVM Profiling. Andrei Pangin Vadim Tsesko

Size: px
Start display at page:

Download "The Art of JVM Profiling. Andrei Pangin Vadim Tsesko"

Transcription

1 The Art of JVM Profiling 2017 Andrei Pangin Vadim Tsesko

2 2

3 Одноклассники 48 M DAU 8500 machines in 4 DC 1.2 Tb/s Up to 70 К QPS/server 99% < 100 ms Java 3

4 Profilers 0

5 What to profile? IO (disk, network) syscalls Synchronisation SQL queries 5

6 How to profile? 6

7 How to profile? Instrumenting Trace method transitions Measure/count Slooow 6

8 How to profile? Instrumenting Trace method transitions Measure/count Slooow Sampling Snapshot state Periodic Suitable for PROD 6

9 Thread Dump 1

10 How does it work? Java Thread.getAllStackTraces() class StackTraceElement { String declaringclass; String methodname; String filename; int linenumber; } Native (JVM TI) GetAllStackTraces() struct { jmethodid method; jlocation location; }

11 Overhead 9

12 Overhead 1K threads ~ 10 MB up to 50 ms 9

13 Advantages Simple All Java platforms and versions No JVM options needed VisualVM, Java Mission Control, YourKit, JProfiler,... 10

14 DEMO 11

15 Safepoint Thread 1 Thread 2 safepoint request memory access math loop return 12

16 Safepoint Thread 1 Thread 2 safepoint request memory access math safepoint start return loop 12

17 Are Safepoint we there yet? safepoint request Thread 1 Thread 2 memory access math safepoint start return loop 13

18 for-loop public Theme getthemebyid(long id) { for (int i = 0; i < themes.length; i++) { if (id.equals(themes[i].getid())) { return themes[i]; } } return null; }

19 for-loop public Theme getthemebyid(long id) { for (int i = 0; i < themes.length; i++) { if (id.equals(themes[i].getid())) { return themes[i]; } } return null; } -XX:+UseCountedLoopSafepoints

20 Safepoints make profiling Useless Unreliable It happens

21 DEMO 16

22 Off CPU All threads Native RUNNABLE How to interpret? 17

23 Can we do better? Problems Safepoints Off CPU Native 18

24 Can we do better? Problems Safepoints Off CPU Native 18

25 AsyncGetCallTrace 2

26 How does it work? AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) from signal handler itimer() + SIGPROF 20

27 How does it work? AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) from signal handler itimer() + SIGPROF Oracle Developer Studio github.com/jvm-profiling-tools/honest-profiler github.com/apangin/async-profiler 20

28 DEMO 21

29 Advantages Not limited to safepoints -XX:+DebugNonSafepoints Active threads All Java: interpreted, compiled, inlined 22

30 Disadvantages Windows Native JVM (GC, compiler ) 23

31 DEMO 24

32 Problems enum { ticks_no_java_frame = 0, ticks_no_class_load = -1, ticks_gc_active = -2, ticks_unknown_not_java = -3, ticks_not_walkable_not_java = -4, ticks_unknown_java = -5, ticks_not_walkable_java = -6, ticks_unknown_state = -7, ticks_thread_exit = -8, ticks_deopt = -9, ticks_safepoint = -10 }; src/share/vm/prims/forte.cpp 25

33 Inconsistent frame public int getx() { return x; } mov %eax,-0x6000(%rsp) push %rbp sub $0x30,%rsp mov 0xc(%rdx),%eax add $0x30,%rsp pop %rbp test %eax,-0x12345a(%rip) retq 26

34 Inconsistent frame public int getx() { return x; } mov %eax,-0x6000(%rsp) push %rbp sub $0x30,%rsp mov 0xc(%rdx),%eax add $0x30,%rsp pop %rbp test %eax,-0x12345a(%rip) retq Prologue Epilogue 26

35 Workaround 1. Fix SP, IP 2. Retry AsyncGetCallTrace() unknown_java < 0.05% bugs.openjdk.java.net/browse/jdk

36 DEMO 28

37 Visualisation 3

38 Flat 30

39 Tree 31

40 DEMO brendangregg.com 32

41 Can we do better? Problems Safepoints Off CPU Native 33

42 Perf Events 4

43 PMU 35

44 PMU HW Events Cycles, instructions Cache misses, branch misses HW interrupts 35

45 PMU HW interrupts HW Events Cycles, instructions Cache misses, branch misses SW events CPU clock Page faults Context switches 35

46 perf_event_open() Linux syscall fd counter mmap page samples 36

47 perf_event_open() Linux syscall fd counter mmap page samples Samples pid, tid CPU registers Call chain (user + kernel) S S 36

48 perf $ perf record F 999 java... $ perf report perf.wiki.kernel.org/index.php/tutorial 37

49 perf $ perf record F 999 java... $ perf report 4.70% java [kernel.kallsyms] [k] clear_page_c 2.10% java libpthread-2.17.so [.] pthread_cond_wait 1.97% java libjvm.so [.] Unsafe_Park 1.40% java libjvm.so [.] Parker::park 1.31% java [kernel.kallsyms] [k] try_to_wake_up 1.31% java perf map [.] 0x00007f8510e9e % java perf map [.] 0x00007f8510e9e89e 1.17% java perf map [.] 0x00007f8510e9cc17 perf.wiki.kernel.org/index.php/tutorial 37

50 perf $ perf record F 999 java... $ perf report 4.70% java [kernel.kallsyms] [k] clear_page_c 2.10% java libpthread-2.17.so [.] pthread_cond_wait 1.97% java libjvm.so [.] Unsafe_Park 1.40% java libjvm.so [.] Parker::park 1.31% java [kernel.kallsyms] [k] try_to_wake_up 1.31% java perf map [.] 0x00007f8510e9e % java perf map [.] 0x00007f8510e9e89e 1.17% java perf map [.] 0x00007f8510e9cc17 perf.wiki.kernel.org/index.php/tutorial 37

51 Java symbols No symbols for JITted code /tmp/perf-<pid>.map 7fe0e java.lang.object::<init> 7fe0e91175e0 140 java.lang.string::hashcode 7fe0e java.lang.math::min 7fe0e9117ae0 60 java.lang.string::length 7fe0e9117d java.lang.string::indexof 38

52 JVM TI CompiledMethodLoad() DynamicCodeGenerated() // Compiled Java // VM Runtime $ java -agentpath:/usr/lib/libperfmap.so github.com/jrudolph/perf-map-agent 39

53 Native stack SP prev BP ret1 BP 0 40

54 Native stack SP prev BP ret2 BP prev BP ret1 0 40

55 Native stack SP IP current method prev BP ret2 BP method 2 prev BP ret1 method

56 Native stack SP IP current method prev BP ret2 BP method 2 prev BP ret1 method

57 Java stack SP ret2 BP ret1 41

58 Java stack SP ret2 BP ret1 -XX:+PreserveFramePointer 41

59 DEMO $ perf record -F $HZ -o $RAW -g -p $PID -- sleep $SEC $ perf script -i $RAW > $PERF $ FlameGraph/stackcollapse-perf.pl $PERF > $STACKS $ FlameGraph/flamegraph.pl $STACKS > $SVG github.com/brendangregg/flamegraph 42

60 App startup

61 App startup WTF?!

62 Hot interpreter 44

63 Hot interpreter com.maxmind.geoip.regionname::regionnamebycode 44

64 Poor GeoIP library if (country_code.equals("ru")) { switch (region_code) { case 1: name = "Adygeya"; break; case 2: name = "Aginsky Buryatsky AO"; break; case 3: name = "Gorno-Altaysk"; break;... 45

65 Poor GeoIP library if (country_code.equals("ru")) { switch (region_code) { case 1: name = "Adygeya"; break; case 2: name = "Aginsky Buryatsky AO"; break; case 3: name = "Gorno-Altaysk"; break;... -XX:-DontCompileHugeMethods 45

66 Disadvantages 46

67 Disadvantages No interpreted Java -XX:+PreserveFramePointer 46

68 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 46

69 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 JIT recompile 46

70 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 JIT recompile /proc/sys/kernel/perf_event_paranoid 46

71 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 JIT recompile /proc/sys/kernel/perf_event_paranoid Limited stack depth 46

72 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 JIT recompile /proc/sys/kernel/perf_event_paranoid Limited stack depth Unstable (many threads) 46

73 Disadvantages No interpreted Java -XX:+PreserveFramePointer Java 8u60 JIT recompile /proc/sys/kernel/perf_event_paranoid Limited stack depth Unstable (many threads) Big data :) 46

74 Full-stack Profiler 5

75 Ideal profiler perf_event_open() Kernel + native stacks HW counters Full Java stack Fast and simple AsyncGetCallTrace() 48

76 Put together xfs_file_aio_read sys_read system_call_fastpath SIGIO perf S S readbytes

77 Put together xfs_file_aio_read sys_read system_call_fastpath SIGIO perf S S readbytes java.io.fileinputstream::readbytes java.io.fileinputstream::read JavaApp::main AsyncGetCallTrace

78 Put together xfs_file_aio_read sys_read system_call_fastpath SIGIO perf S S readbytes java.io.fileinputstream::readbytes java.io.fileinputstream::read JavaApp::main AsyncGetCallTrace fcntl(): signal owner = this thread

79 Issues Stack merge point Online aggregation Native symbols Event-per-thread ulimit n /proc/sys/kernel/perf_event_mlock_kb Concurrency 50

80 Case: file reading byte[] buf = new byte[bufsize]; try (FileInputStream in = new FileInputStream(fileName)) { int bytesread; while ((bytesread = in.read(buf)) > 0) {... } }

81 Case: file reading byte[] buf = new byte[bufsize]; try (FileInputStream in = new FileInputStream(fileName)) { int bytesread; } while ((bytesread = in.read(buf)) > 0) {... } Buffer size? 8 K 64 K 250 K 1 M 4 M

82 Full-stack profile 52

83 Full-stack profile 52

84 Full-stack profile Read buffer: 260K => 250K 53

85 AsyncGCT Perf Full-stack Profiler Java stack Yes No interpreted Yes Native stack No Yes Yes Kernel stack No Yes Yes JDK version 6+ 8u Idle overhead 0 2-5% 0 Online aggregation Yes No Yes Stable Yes No Yes 54

86 Future improvements Full-stack profiler Perf AsyncGetCallTrace Thread dump CPU utilisation? Performance problem? 55

87 Try it github.com/apangin/async-profiler Contributions are welcome! 56

88 Contacts Andrei Vadim 57

89

Welcome to the session...

Welcome to the session... Welcome to the session... Copyright 2013, Oracle and/or its affiliates. All rights reserved. 02/22/2013 1 The following is intended to outline our general product direction. It is intended for information

More information

Method-Level Phase Behavior in Java Workloads

Method-Level Phase Behavior in Java Workloads Method-Level Phase Behavior in Java Workloads Andy Georges, Dries Buytaert, Lieven Eeckhout and Koen De Bosschere Ghent University Presented by Bruno Dufour dufour@cs.rutgers.edu Rutgers University DCS

More information

ART JIT in Android N. Xueliang ZHONG Linaro ART Team

ART JIT in Android N. Xueliang ZHONG Linaro ART Team ART JIT in Android N Xueliang ZHONG Linaro ART Team linaro-art@linaro.org 1 Outline Android Runtime (ART) and the new challenges ART Implementation in Android N Tooling Performance Data & Findings Q &

More information

Zing Vision. Answering your toughest production Java performance questions

Zing Vision. Answering your toughest production Java performance questions Zing Vision Answering your toughest production Java performance questions Outline What is Zing Vision? Where does Zing Vision fit in your Java environment? Key features How it works Using ZVRobot Q & A

More information

Efficient and Large Scale Program Flow Tracing in Linux. Alexander Shishkin, Intel

Efficient and Large Scale Program Flow Tracing in Linux. Alexander Shishkin, Intel Efficient and Large Scale Program Flow Tracing in Linux Alexander Shishkin, Intel 16.09.2013 Overview Program flow tracing - What is it? - What is it good for? Intel Processor Trace - Features / capabilities

More information

Is your profiler speaking the same language as you? Simon

Is your profiler speaking the same language as you? Simon Is your profiler speaking the same language as you? Simon Maple @sjmaple Simon Maple - @sjmaple Agenda Performance Tools Performance by numbers Sampling vs Tracing XRebel JRebel 3 Performance Tools Java

More information

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu and Toshio Nakatani IBM Research Tokyo IBM Research T.J. Watson Research Center April

More information

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. OS and Computer Architecture Last class: OS and Architecture OS and Computer Architecture OS Service Protection Interrupts System Calls IO Scheduling Synchronization Virtual Memory Hardware Support Kernel/User Mode Protected Instructions

More information

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components Last class: OS and Architecture Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation

More information

Compiler Design Spring 2017

Compiler Design Spring 2017 Compiler Design Spring 2017 6.0 Runtime system and object layout Dr. Zoltán Majó Compiler Group Java HotSpot Virtual Machine Oracle Corporation 1 Runtime system Some open issues from last time Handling

More information

Sista: Improving Cog s JIT performance. Clément Béra

Sista: Improving Cog s JIT performance. Clément Béra Sista: Improving Cog s JIT performance Clément Béra Main people involved in Sista Eliot Miranda Over 30 years experience in Smalltalk VM Clément Béra 2 years engineer in the Pharo team Phd student starting

More information

Apache Spark 2.0 Performance Improvements Investigated With Flame Graphs. Luca Canali CERN, Geneva (CH)

Apache Spark 2.0 Performance Improvements Investigated With Flame Graphs. Luca Canali CERN, Geneva (CH) Apache Spark 2.0 Performance Improvements Investigated With Flame Graphs Luca Canali CERN, Geneva (CH) Speaker Intro Database engineer and team lead at CERN IT Hadoop and Spark service Database services

More information

Chapter 2: System Structures

Chapter 2: System Structures Chapter 2: System Structures Chapter 2: System Structures 2.1 Operating-System Services 2.2 User and Operating-System Interface 2.3 System Calls 2.4 Types of System Calls 2.5 System Programs 2.6 Operating-System

More information

Processes (Intro) Yannis Smaragdakis, U. Athens

Processes (Intro) Yannis Smaragdakis, U. Athens Processes (Intro) Yannis Smaragdakis, U. Athens Process: CPU Virtualization Process = Program, instantiated has memory, code, current state What kind of memory do we have? registers + address space Let's

More information

Don t Get Caught In the Cold, Warm-up Your JVM Understand and Eliminate JVM Warm-up Overhead in Data-parallel Systems

Don t Get Caught In the Cold, Warm-up Your JVM Understand and Eliminate JVM Warm-up Overhead in Data-parallel Systems Don t Get Caught In the Cold, Warm-up Your JVM Understand and Eliminate JVM Warm-up Overhead in Data-parallel Systems David Lion, Adrian Chiu, Hailong Sun*, Xin Zhuang, Nikola Grcevski, Ding Yuan University

More information

Virtual Machine Design

Virtual Machine Design Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview

More information

Mission Possible - Near zero overhead profiling. Klara Ward Principal Software Developer Java Mission Control team, Oracle February 6, 2018

Mission Possible - Near zero overhead profiling. Klara Ward Principal Software Developer Java Mission Control team, Oracle February 6, 2018 Mission Possible - Near zero overhead profiling Klara Ward Principal Software Developer Java Mission Control team, Oracle February 6, 2018 Hummingbird image by Yutaka Seki is licensed under CC BY 2.0 Copyright

More information

Dynamic Binary Instrumentation: Introduction to Pin

Dynamic Binary Instrumentation: Introduction to Pin Dynamic Binary Instrumentation: Introduction to Pin Instrumentation A technique that injects instrumentation code into a binary to collect run-time information 2 Instrumentation A technique that injects

More information

Project Loom Ron Pressler, Alan Bateman June 2018

Project Loom Ron Pressler, Alan Bateman June 2018 Project Loom Ron Pressler, Alan Bateman June 2018 Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1 Safe Harbor Statement The following is intended to outline our general product direction.

More information

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services Objectives Chapter 2: Operating-System Structures To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system

More information

Performance and Environment Monitoring for Continuous Program Optimization

Performance and Environment Monitoring for Continuous Program Optimization IBM T.J. Watson Research Center Performance and Environment Monitoring for Continuous Program Optimization Evelyn Duesterwald Joint work with R. Azimi, C. Cascaval, M. Hauswirth, K. Sudeep, P. F. Sweeney,

More information

Inject malicious code Call any library functions Modify the original code

Inject malicious code Call any library functions Modify the original code Inject malicious code Call any library functions Modify the original code 2 Sadeghi, Davi TU Darmstadt 2012 Secure, Trusted, and Trustworthy Computing Chapter 6: Runtime Attacks 2 3 Sadeghi, Davi TU Darmstadt

More information

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle Operating Systems Operating System Structure Lecture 2 Michael O Boyle 1 Overview Architecture impact User operating interaction User vs kernel Syscall Operating System structure Layers Examples 2 Lower-level

More information

Lecture 9 Dynamic Compilation

Lecture 9 Dynamic Compilation Lecture 9 Dynamic Compilation I. Motivation & Background II. Overview III. Compilation Policy IV. Partial Method Compilation V. Partial Dead Code Elimination VI. Escape Analysis VII. Results Partial Method

More information

Use Dynamic Analysis Tools on Linux

Use Dynamic Analysis Tools on Linux Use Dynamic Analysis Tools on Linux FTF-SDS-F0407 Gene Fortanely Freescale Software Engineer Catalin Udma A P R. 2 0 1 4 Software Engineer, Digital Networking TM External Use Session Introduction This

More information

Adaptive Optimization using Hardware Performance Monitors. Master Thesis by Mathias Payer

Adaptive Optimization using Hardware Performance Monitors. Master Thesis by Mathias Payer Adaptive Optimization using Hardware Performance Monitors Master Thesis by Mathias Payer Supervising Professor: Thomas Gross Supervising Assistant: Florian Schneider Adaptive Optimization using HPM 1/21

More information

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. Operating System Services User Operating System Interface

More information

From Processes to Threads

From Processes to Threads From Processes to Threads 1 Processes, Threads and Processors Hardware can interpret N instruction streams at once Uniprocessor, N==1 Dual-core, N==2 Sun s Niagra T2 (2007) N == 64, but 8 groups of 8 An

More information

Android Debugging ART

Android Debugging ART Android Debugging ART Khaled JMAL 2016 / 11 / 17 2 / 24 The Dalvik Virtual Machine Up to version 4.4 KitKat, Android was based on the Dalvik Virtual Machine Java compiles into DEX code DEX code is compiled

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems OS Structures and System Calls Jaswinder Pal Singh Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) Outline Protection mechanisms

More information

Soumava Ghosh The University of Texas at Austin

Soumava Ghosh The University of Texas at Austin Soumava Ghosh The University of Texas at Austin Agenda Overview of programs that perform I/O Linking, loading and the x86 model Modifying programs to perform I/O on the x86 model Interpreting and loading

More information

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure Architecture and OS To do q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure Computer architecture and OS OS is intimately tied to the hardware it runs on

More information

Chapter 3: Operating-System Structures

Chapter 3: Operating-System Structures Chapter 3: Operating-System Structures System Components Operating System Services System Calls POSIX System Programs System Structure Virtual Machines System Design and Implementation System Generation

More information

Workload Characterization and Optimization of TPC-H Queries on Apache Spark

Workload Characterization and Optimization of TPC-H Queries on Apache Spark Workload Characterization and Optimization of TPC-H Queries on Apache Spark Tatsuhiro Chiba and Tamiya Onodera IBM Research - Tokyo April. 17-19, 216 IEEE ISPASS 216 @ Uppsala, Sweden Overview IBM Research

More information

Background: Operating Systems

Background: Operating Systems Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M030 9 th October 2015 Outline Goals of an operating system Sketch of UNIX User processes, kernel Process-kernel communication Waiting

More information

Managed runtimes & garbage collection

Managed runtimes & garbage collection Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security

More information

Analyzing Kernel Behavior by SystemTap

Analyzing Kernel Behavior by SystemTap Analyzing Kernel Behavior by SystemTap Kernel Tracer Approach 2009/2/25 Hitachi, Ltd., Software Division Noboru Obata ( ) Hitachi, Ltd. 2009. All rights reserved. Contents 1. Improving RAS Features for

More information

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Lecture 5: Thread Ryan Huang Administrivia HW1 solution released on Piazza resources Lab 0 grading - In progress - Cheating policy Lab 1 review session

More information

Live Patching: The long road from Kernel to User Space. João Moreira Toolchain Engineer - SUSE Labs

Live Patching: The long road from Kernel to User Space. João Moreira Toolchain Engineer - SUSE Labs Live Patching: The long road from Kernel to User Space João Moreira Toolchain Engineer - SUSE Labs jmoreira@suse.de Software has bugs, and bugs have to be fixed + security issues + execution degradation

More information

CISC2200 Threads Spring 2015

CISC2200 Threads Spring 2015 CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates

More information

top - 14:43:26 up 25 days, 3:46, 50 users, load average: 0.04, 0.05, 0.01 Tasks: 1326 total, 1 running, 1319 sleeping, 2 stopped, 4 zombie Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si,

More information

OPERATING SYSTEM OVERVIEW

OPERATING SYSTEM OVERVIEW OPERATING SYSTEM OVERVIEW Contents Basic hardware elements Interrupts Most I/O devices are much slower than the processor Active waiting cycle (polling) Interrupt request signal Interrupt mechanism An

More information

Protection and System Calls. Otto J. Anshus

Protection and System Calls. Otto J. Anshus Protection and System Calls Otto J. Anshus Protection Issues CPU protection Prevent a user from using the CPU for too long Throughput of jobs, and response time to events (incl. user interactive response

More information

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management Last class: OS and Architecture OS and Computer Architecture OS Service Protection Interrupts System Calls IO Scheduling Synchronization Virtual Memory Hardware Support Kernel/User Mode Protected Instructions

More information

CSc 453 Interpreters & Interpretation

CSc 453 Interpreters & Interpretation CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson Interpreters An interpreter is a program that executes another program. An interpreter implements a virtual machine,

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 4, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

Chapter 3: Operating-System Structures

Chapter 3: Operating-System Structures Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation 3.1

More information

CS 5460/6460 Operating Systems

CS 5460/6460 Operating Systems CS 5460/6460 Operating Systems Fall 2009 Instructor: Matthew Flatt Lecturer: Kevin Tew TAs: Bigyan Mukherjee, Amrish Kapoor 1 Join the Mailing List! Reminders Make sure you can log into the CADE machines

More information

Alan Bateman Java Platform Group, Oracle November Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1

Alan Bateman Java Platform Group, Oracle November Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1 Alan Bateman Java Platform Group, Oracle November 2018 Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1 Project Loom Continuations Fibers Tail-calls Copyright 2018, Oracle and/or its

More information

Code Instrumentation, Dynamic Tracing

Code Instrumentation, Dynamic Tracing Code Instrumentation, Dynamic Tracing http://d3s.mff.cuni.cz/aosy http://d3s.mff.cuni.cz Martin Děcký decky@d3s.mff.cuni.cz Observability What is the system doing? Beyond the obvious (externally visible

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems OS Structures and System Calls Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Outline Protection

More information

Four Components of a Computer System

Four Components of a Computer System Four Components of a Computer System Operating System Concepts Essentials 2nd Edition 1.1 Silberschatz, Galvin and Gagne 2013 Operating System Definition OS is a resource allocator Manages all resources

More information

Overview. Thread Packages. Threads The Thread Model (1) The Thread Model (2) The Thread Model (3) Thread Usage (1)

Overview. Thread Packages. Threads The Thread Model (1) The Thread Model (2) The Thread Model (3) Thread Usage (1) Overview Thread Packages Thomas Plagemann With slides from O. Anshus, C. Griwodz, M. van Steen, and A. Tanenbaum What are threads? Why threads? Example: Da CaPo 1.0 Thread implementation User level level

More information

Profiling & Optimization

Profiling & Optimization Lecture 11 Sources of Game Performance Issues? 2 Avoid Premature Optimization Novice developers rely on ad hoc optimization Make private data public Force function inlining Decrease code modularity removes

More information

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network Important Times COS 318: Operating Systems Overview Jaswinder Pal Singh and a Fabulous Course Staff Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) u Precepts:

More information

Architectural Support for Operating Systems

Architectural Support for Operating Systems Architectural Support for Operating Systems Today Computer system overview Next time OS components & structure Computer architecture and OS OS is intimately tied to the hardware it runs on The OS design

More information

24-vm.txt Mon Nov 21 22:13: Notes on Virtual Machines , Fall 2011 Carnegie Mellon University Randal E. Bryant.

24-vm.txt Mon Nov 21 22:13: Notes on Virtual Machines , Fall 2011 Carnegie Mellon University Randal E. Bryant. 24-vm.txt Mon Nov 21 22:13:36 2011 1 Notes on Virtual Machines 15-440, Fall 2011 Carnegie Mellon University Randal E. Bryant References: Tannenbaum, 3.2 Barham, et al., "Xen and the art of virtualization,"

More information

AMD CodeXL 1.3 GA Release Notes

AMD CodeXL 1.3 GA Release Notes AMD CodeXL 1.3 GA Release Notes Thank you for using CodeXL. We appreciate any feedback you have! Please use the CodeXL Forum to provide your feedback. You can also check out the Getting Started guide on

More information

Operating- System Structures

Operating- System Structures Operating- System Structures 2 CHAPTER Practice Exercises 2.1 What is the purpose of system calls? Answer: System calls allow user-level processes to request services of the operating system. 2.2 What

More information

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder JAVA PERFORMANCE PR SW2 S18 Dr. Prähofer DI Leopoldseder OUTLINE 1. What is performance? 1. Benchmarking 2. What is Java performance? 1. Interpreter vs JIT 3. Tools to measure performance 4. Memory Performance

More information

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester Operating System: Chap2 OS Structure National Tsing-Hua University 2016, Fall Semester Outline OS Services OS-Application Interface OS Structure Chapter2 OS-Structure Operating System Concepts NTHU LSA

More information

ECE 571 Advanced Microprocessor-Based Design Lecture 2

ECE 571 Advanced Microprocessor-Based Design Lecture 2 ECE 571 Advanced Microprocessor-Based Design Lecture 2 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 4 September 2014 Announcements HW#1 delayed until Tuesday 1 Hardware Performance

More information

Linux Container Performance Tools for JVM Applications

Linux Container Performance Tools for JVM Applications Sasha Goldshtein CTO, Sela Group @goldshtn github.com/goldshtn Linux Container Performance Tools for JVM Applications Copyright SELA Software & Education Labs Ltd. 14-18 Baruch Hirsch St Bnei Brak, 51202

More information

Performance Profiling

Performance Profiling Performance Profiling Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University msryu@hanyang.ac.kr Outline History Understanding Profiling Understanding Performance Understanding Performance

More information

Optimizing JVM profiling performance for Honest Profiler

Optimizing JVM profiling performance for Honest Profiler UNIVERSITY OF TARTU Institute of Computer Science Computer Science Curriculum Tiit Oja Optimizing JVM profiling performance for Honest Profiler Bachelor s Thesis (9 ECTS) Supervisor: Supervisor: Vootele

More information

Square Pegs in Round holes. Paweł Moll

Square Pegs in Round holes. Paweł Moll Square Pegs in Round holes or or System System Level Level Performance Performance Data Data and and perf perf Paweł Moll 1 The plan Problem definition s Systems perf and non-s Examples

More information

SDK/RTE for Debian Linux on Intel Itanium Processors Release Notes

SDK/RTE for Debian Linux on Intel Itanium Processors Release Notes SDK/RTE 1.4.2.09 for Debian Linux on Intel Itanium Processors Release Notes HP Part Number: 5900-1453 Published: December 2010 Edition: 1.0 Copyright 2010 Hewlett-Packard Development Company, L.P. Legal

More information

Processors, Performance, and Profiling

Processors, Performance, and Profiling Processors, Performance, and Profiling Architecture 101: 5-Stage Pipeline Fetch Decode Execute Memory Write-Back Registers PC FP ALU Memory Architecture 101 1. Fetch instruction from memory. 2. Decode

More information

Sistemi in Tempo Reale

Sistemi in Tempo Reale Laurea Specialistica in Ingegneria dell'automazione Sistemi in Tempo Reale Giuseppe Lipari Introduzione alla concorrenza Fundamentals Algorithm: It is the logical procedure to solve a certain problem It

More information

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful?

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful? Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads!! How is a thread different from a process?!! Why are threads useful?!! How can OSIX threads be useful?!! What are user-level and kernel-level

More information

Quality in the Data Center: Data Collection and Analysis

Quality in the Data Center: Data Collection and Analysis Quality in the Data Center: Data Collection and Analysis Kingsum Chow, Chief Scientist Alibaba Systems Software Hardware Co-Optimization PNSQC 2017.10.07 3:45pm-5:20pm Acknowledged: Chengdong Li and Wanyi

More information

Operating Systems ECE344

Operating Systems ECE344 Operating Systems ECE344 Ding Yuan Announcements & reminders Lab schedule is out Form your group of 2 by this Friday (18 th ), 5PM Grading policy: Final exam: 50% Midterm exam: 25% Lab assignment: 25%

More information

1. port 2: 'a' 3. port 2: '\n' 5. port 1: 'y' 2. port 1: 'x' 4. port 2: 'b' 6. port 1: '\n'

1. port 2: 'a' 3. port 2: '\n' 5. port 1: 'y' 2. port 1: 'x' 4. port 2: 'b' 6. port 1: '\n' CS 7600 Intensive Computer Systems February 24, 2010 Midterm Sample questions These are sample questions previous midterms of mine. Context Switching user processes operating system HW current process

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2018 Lecture 5: Thread Ryan Huang Slides adapted from Geoff Voelker s and David Mazières lectures Administrivia Lab 0 grading in progress Lab 1 review session

More information

Advanced Computer Architecture

Advanced Computer Architecture ECE 563 Advanced Computer Architecture Fall 2007 Lecture 14: Virtual Machines 563 L14.1 Fall 2009 Outline Types of Virtual Machine User-level (or Process VMs) System-level Techniques for implementing all

More information

! How is a thread different from a process? ! Why are threads useful? ! How can POSIX threads be useful?

! How is a thread different from a process? ! Why are threads useful? ! How can POSIX threads be useful? Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads! How is a thread different from a process?! Why are threads useful?! How can OSIX threads be useful?! What are user-level and kernel-level

More information

ECE 571 Advanced Microprocessor-Based Design Lecture 2

ECE 571 Advanced Microprocessor-Based Design Lecture 2 ECE 571 Advanced Microprocessor-Based Design Lecture 2 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 21 January 2016 Announcements HW#1 will be posted tomorrow I am handing out

More information

MODULE 1 JAVA PLATFORMS. Identifying Java Technology Product Groups

MODULE 1 JAVA PLATFORMS. Identifying Java Technology Product Groups MODULE 1 JAVA PLATFORMS Identifying Java Technology Product Groups Java SE Platform Versions Year Developer Version (JDK) Platform 1996 1.0 1 1997 1.1 1 1998 1.2 2 2000 1.3 2 2002 1.4 2 2004 1.5 5 2006

More information

ebpf Tooling and Debugging Infrastructure

ebpf Tooling and Debugging Infrastructure ebpf Tooling and Debugging Infrastructure Quentin Monnet Fall ebpf Webinar Series 2018-10-09 Netronome 2018 Injecting Programs into the Kernel ebpf programs are usually compiled from C (or Go, Rust, Lua

More information

Full file at

Full file at Import Settings: Base Settings: Brownstone Default Highest Answer Letter: D Multiple Keywords in Same Paragraph: No Chapter: Chapter 2 Multiple Choice 1. A is an example of a systems program. A) command

More information

March 10, Linux Live Patching. Adrien schischi Schildknecht. Why? Who? How? When? (consistency model) Conclusion

March 10, Linux Live Patching. Adrien schischi Schildknecht. Why? Who? How? When? (consistency model) Conclusion March 10, 2015 Section 1 Why Goal: apply a binary patch to kernel on-line. is done without shutdown quick response to a small but critical issue the goal is not to avoid downtime Limitations: simple changes

More information

Java performance - not so scary after all

Java performance - not so scary after all Java performance - not so scary after all Holly Cummins IBM Hursley Labs 2009 IBM Corporation 2001 About me Joined IBM Began professional life writing event framework for WebSphere 2004 Moved to work on

More information

JDK 9/10/11 and Garbage Collection

JDK 9/10/11 and Garbage Collection JDK 9/10/11 and Garbage Collection Thomas Schatzl Senior Member of Technical Staf Oracle JVM Team May, 2018 thomas.schatzl@oracle.com Copyright 2017, Oracle and/or its afliates. All rights reserved. 1

More information

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group Operating Systems (2INC0) 20/19 Introduction (01) Dr. Courtesy of Prof. Dr. Johan Lukkien System Architecture and Networking Group Course Overview Introduction to operating systems Processes, threads and

More information

Overhead Evaluation about Kprobes and Djprobe (Direct Jump Probe)

Overhead Evaluation about Kprobes and Djprobe (Direct Jump Probe) Overhead Evaluation about Kprobes and Djprobe (Direct Jump Probe) Masami Hiramatsu Hitachi, Ltd., SDL Jul. 13. 25 1. Abstract To implement flight recorder system, the overhead

More information

T Jarkko Turkulainen, F-Secure Corporation

T Jarkko Turkulainen, F-Secure Corporation T-110.6220 2010 Emulators and disassemblers Jarkko Turkulainen, F-Secure Corporation Agenda Disassemblers What is disassembly? What makes up an instruction? How disassemblers work Use of disassembly In

More information

Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Comprehensive Kernel Instrumentation via Dynamic Binary Translation Comprehensive Kernel Instrumentation via Dynamic Binary Translation Peter Feiner Angela Demke Brown Ashvin Goel University of Toronto 011 Complexity of Operating Systems 012 Complexity of Operating Systems

More information

W4118: PC Hardware and x86. Junfeng Yang

W4118: PC Hardware and x86. Junfeng Yang W4118: PC Hardware and x86 Junfeng Yang A PC How to make it do something useful? 2 Outline PC organization x86 instruction set gcc calling conventions PC emulation 3 PC board 4 PC organization One or more

More information

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

CSC369 Lecture 2. Larry Zhang

CSC369 Lecture 2. Larry Zhang CSC369 Lecture 2 Larry Zhang 1 Announcements Lecture slides Midterm timing issue Assignment 1 will be out soon! Start early, and ask questions. We will have bonus for groups that finish early. 2 Assignment

More information

Sri Vidya College of Engineering & Technology Question Bank

Sri Vidya College of Engineering & Technology Question Bank 1. What is exception? UNIT III EXCEPTION HANDLING AND I/O Part A Question Bank An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program s instructions.

More information

Homework / Exam. Return and Review Exam #1 Reading. Machine Projects. Labs. S&S Extracts , PIC Data Sheet. Start on mp3 (Due Class 19)

Homework / Exam. Return and Review Exam #1 Reading. Machine Projects. Labs. S&S Extracts , PIC Data Sheet. Start on mp3 (Due Class 19) Homework / Exam Return and Review Exam #1 Reading S&S Extracts 385-393, PIC Data Sheet Machine Projects Start on mp3 (Due Class 19) Labs Continue in labs with your assigned section 1 Interrupts An interrupt

More information

Dynamic Tracing and Instrumentation

Dynamic Tracing and Instrumentation Dynamic Tracing and Instrumentation Bryan Cantrill and Mike Shapiro (bmc, mws@eng.sun.com) Solaris Kernel Group Kernel Debugging Today if (no_advanced_debugging) printf(9f) ASSERT(i_am_a_debug_kernel!=

More information

CSC369 Lecture 2. Larry Zhang, September 21, 2015

CSC369 Lecture 2. Larry Zhang, September 21, 2015 CSC369 Lecture 2 Larry Zhang, September 21, 2015 1 Volunteer note-taker needed by accessibility service see announcement on Piazza for details 2 Change to office hour to resolve conflict with CSC373 lecture

More information

Profilers and Debuggers. Introductory Material. One-Slide Summary

Profilers and Debuggers. Introductory Material. One-Slide Summary Profilers and Debuggers #1 Introductory Material First, who doesn t know assembly language? You ll get to answer all the assembly questions. Yes, really. Lecture Style: Sit on the table and pose questions.

More information

Profiling: Understand Your Application

Profiling: Understand Your Application Profiling: Understand Your Application Michal Merta michal.merta@vsb.cz 1st of March 2018 Agenda Hardware events based sampling Some fundamental bottlenecks Overview of profiling tools perf tools Intel

More information

Separating Access Control Policy, Enforcement, and Functionality in Extensible Systems. Robert Grimm University of Washington

Separating Access Control Policy, Enforcement, and Functionality in Extensible Systems. Robert Grimm University of Washington Separating Access Control Policy, Enforcement, and Functionality in Extensible Systems Robert Grimm University of Washington Extensions Added to running system Interact through low-latency interfaces Form

More information

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008 Agenda Threads CSCI 444/544 Operating Systems Fall 2008 Thread concept Thread vs process Thread implementation - user-level - kernel-level - hybrid Inter-process (inter-thread) communication What is Thread

More information

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1 SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine David Bélanger dbelan2@cs.mcgill.ca Sable Research Group McGill University Montreal, QC January 28, 2004 SABLEJIT: A Retargetable

More information