Coping with Immutable Data in a JVM for Embedded Real-Time Systems. Christoph Erhardt, Simon Kuhnle, Isabella Stilkerich, Wolfgang Schröder-Preikschat

Size: px
Start display at page:

Download "Coping with Immutable Data in a JVM for Embedded Real-Time Systems. Christoph Erhardt, Simon Kuhnle, Isabella Stilkerich, Wolfgang Schröder-Preikschat"

Transcription

1 The final Frontier Coping with Immutable Data in a JVM for Embedded Real-Time Systems Christoph Erhardt, Simon Kuhnle, Isabella Stilkerich, Wolfgang Schröder-Preikschat

2 Introduction Embedded devices Weak CPU Limited memory SRAM expensive, scarce Flash cheaper, more ample The final Frontier (JTRES 2014) Introduction 2

3 Introduction Embedded devices Weak CPU Limited memory SRAM expensive, scarce Flash cheaper, more ample Embedded programming in Java Productivity Safety The final Frontier (JTRES 2014) Introduction 2

4 Introduction MIN SPEED MAX Embedded devices Weak CPU Limited memory SRAM expensive, scarce Flash cheaper, more ample Embedded programming in Java Productivity Safety! Performance AOT compilation Dependent on effective optimisations The final Frontier (JTRES 2014) Introduction 2

5 Introduction MIN SPEED MAX Embedded devices Weak CPU Limited memory SRAM expensive, scarce Flash cheaper, more ample Embedded programming in Java Productivity Safety! Performance AOT compilation Dependent on effective optimisations! Memory footprint RAM usage in particular The final Frontier (JTRES 2014) Introduction 2

6 The Trouble with Java s final Qualifier Aids optimisations, but cannot always be declared explicitly Effectively final erhardt@cs.fau.de The final Frontier (JTRES 2014) Introduction 3

7 The Trouble with Java s final Qualifier Aids optimisations, but cannot always be declared explicitly Effectively final No way to mark pointees as constant/immutable public class ConstArray { public static final int[] ARRAY = {10, 2; erhardt@cs.fau.de The final Frontier (JTRES 2014) Introduction 3

8 The Trouble with Java s final Qualifier Aids optimisations, but cannot always be declared explicitly Effectively final No way to mark pointees as constant/immutable public class ConstArray { public static final int[] ARRAY = {10, 2; immutable erhardt@cs.fau.de The final Frontier (JTRES 2014) Introduction 3

9 The Trouble with Java s final Qualifier Aids optimisations, but cannot always be declared explicitly Effectively final No way to mark pointees as constant/immutable public class ConstArray { public static final int[] ARRAY = {10, 2; immutable heap-allocated erhardt@cs.fau.de The final Frontier (JTRES 2014) Introduction 3

10 The Trouble with Java s final Qualifier Aids optimisations, but cannot always be declared explicitly Effectively final No way to mark pointees as constant/immutable public class ConstArray { public static final int[] ARRAY = {10, 2; immutable heap-allocated No statically allocated + initialised arrays No programmatic flash allocation erhardt@cs.fau.de The final Frontier (JTRES 2014) Introduction 3

11 Remedy: Compiler Analyses

12 Platform: KESO JVM 1.2 Motivation GC/Heap Domain A Resources Alarms ISRs Portal Domain B Portal Tasks Domain C KESO Runtime Environment OSEK / AUTOSAR OS Mem-Mapped I/O Device Drivers Microcontroller Portable, scalable to low-end devices Figure 1.1: Schematic overview of a KESO system. An OSEK or AUTOSAR RTOS runs on a microcontroller. On top of the operating system, the KESO runtime environment provides services and abstractions used Staticbyconfiguration the application, such as RPC primitives or device drivers. Multiple protection realms (domains) can contain multiple tasks each, have their own resources, heap, and garbage collector and communicate Ahead-of-time safely using portals. compilation to C code erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 5 Due to the reduction of structure sizes in modern computing chips, dealing with

13 Effectively final Fields public final class Constants { public static int MAX_FRAMES = 1000; public class Main { private static void parsecmdline(final String[] v) { //... if (v[i].equals("max_frames")) Constants.MAX_FRAMES = Integer.parseInt(v[i + 1]); //... erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 6

14 Effectively final Fields public final class Constants { public static int MAX_FRAMES = 1000; public class Main { private static void parsecmdline(final String[] v) { //... if (v[i].equals("max_frames")) Constants.MAX_FRAMES = Integer.parseInt(v[i + 1]); //... unreachable erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 6

15 Effectively final Fields public final class Constants { public static int MAX_FRAMES = 1000; effectively final public class Main { private static void parsecmdline(final String[] v) { //... if (v[i].equals("max_frames")) Constants.MAX_FRAMES = Integer.parseInt(v[i + 1]); //... unreachable erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 6

16 Effectively final Fields public final class Constants { public static int MAX_FRAMES = 1000; effectively final public class Main { private static void parsecmdline(final String[] v) { //... if (v[i].equals("max_frames")) Constants.MAX_FRAMES = Integer.parseInt(v[i + 1]); //... unreachable Let s focus on static fields for now. erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 6

17 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { MAX_FRAMES = 1000; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

18 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { MAX_FRAMES = 1000; Criteria 1. Field is written exactly once, in the class constructor erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

19 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { if (...) { MAX_FRAMES = 1000; Criteria 1. Field is written exactly once, in the class constructor erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

20 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { System.out.println("MAX_FRAMES = " + MAX_FRAMES); MAX_FRAMES = 1000; Criteria 1. Field is written exactly once, in the class constructor 2. No read prior to initialisation Within class constructor Within method called from class constructor erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

21 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { MAX_FRAMES = 1000; Criteria 1. Field is written exactly once, in the class constructor 2. No read prior to initialisation Within class constructor Within method called from class constructor erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

22 Finding Effectively final Fields public final class Constants { public static int MAX_FRAMES; static { MAX_FRAMES = 1000; Criteria 1. Field is written exactly once, in the class constructor 2. No read prior to initialisation Within class constructor Within method called from class constructor Effect on optimisations Constant folding, check elision Potentially many indirect effects! erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 7

23 Finding Constant Arrays public class ConstArray { public static final int[] ARRAY = {10, 2; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 8

24 Finding Constant Arrays public class ConstArray { public static final int[] ARRAY; static { int[] a = new int[2]; a[0] = 10; a[1] = 2; ARRAY = a; Criteria 1. Array created with constant size, in class constructor erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 8

25 Finding Constant Arrays public class ConstArray { public static final int[] ARRAY; static { int[] a = new int[2]; a[0] = 10; a[1] = 2; ARRAY = a; Criteria 1. Array created with constant size, in class constructor 2. All writes are to constant indices, with constant values, not more than once per index erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 8

26 Finding Constant Arrays public class ConstArray { public static final int[] ARRAY; static { int[] a = new int[2]; a[0] = 10; a[1] = 2; ARRAY = a; Criteria 1. Array created with constant size, in class constructor 2. All writes are to constant indices, with constant values, not more than once per index 3. No reads prior to initialisation Consider aliasing! erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 8

27 Finding Constant Arrays public class ConstArray { public static final int[] ARRAY; static { int[] a = new int[2]; a[0] = 10; a[1] = 2; ARRAY = a; Criteria 1. Array created with constant size, in class constructor 2. All writes are to constant indices, with constant values, not more than once per index 3. No reads prior to initialisation Consider aliasing! Multi-dimensional arrays: bottom-up approach erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 8

28 Static Allocation of Constant Arrays Java source: public class ConstArray { public static final int[] ARRAY = {10, 2; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 9

29 Static Allocation of Constant Arrays Java source: public class ConstArray { public static final int[] ARRAY = {10, 2; Emitted C code: typedef struct { uint16_t classid; uint32_t length; const int32_t data[2]; int_array2_t; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 9

30 Static Allocation of Constant Arrays Java source: public class ConstArray { public static final int[] ARRAY = {10, 2; Emitted C code: typedef struct { uint16_t classid; uint32_t length; const int32_t data[2]; int_array2_t; const int_array2_t ca = { /*.classid = */ INT_ARRAY_ID, /*.length = */ 2, /*.data = */ {10, 2, ; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 9

31 Static Allocation of Constant Arrays Java source: public class ConstArray { public static final int[] ARRAY = {10, 2; Emitted C code: typedef struct { uint16_t classid; uint32_t length; const int32_t data[2]; int_array2_t; const int_array2_t ca = { /*.classid = */ INT_ARRAY_ID, /*.length = */ 2, /*.data = */ {10, 2, ; void ConstArray clinit_(void) { ConstArray_ARRAY = &ca; erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 9

32 Making Use of Flash Memory Constant arrays Declare as const in emitted C code Emit section attribute Adapt linker script erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 10

33 Making Use of Flash Memory Constant arrays Declare as const in emitted C code Emit section attribute Adapt linker script Other candidates for flash allocation Strings from constant pools Runtime-system data structures Type-information store Dispatch table erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 10

34 Flash-Memory Pitfalls Mark-and-sweep GC! Shouldn t try to flip colour bit in flash-allocated object header Don t scan flash-allocated objects erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 11

35 Flash-Memory Pitfalls Mark-and-sweep GC! Shouldn t try to flip colour bit in flash-allocated object header Don t scan flash-allocated objects AVR! Separate access instructions for RAM and flash (ld vs. lpm) For each use: determine correct instruction through alias analysis Prevent aliasing between RAM and flash objects erhardt@cs.fau.de The final Frontier (JTRES 2014) Remedy: Compiler Analyses 11

36 Evaluation

37 Collision Detector CD j 1.2 Real-time air-traffic Variant simulator text data and collision detector CiAO OS Table 1 Baseline final analysis constant TriCore 150 MHz, 2 MiB flash, 1 MiB SRAM strings text data Baseline + final analysis + constant strings erhardt@cs.fau.de The final Frontier (JTRES 2014) Evaluation 13

38 Collision Detector Baseline With effectively-final analysis Relative execution time Iteration FoldedFigure primitive 4.1: Relative constants execution time of the CD x on-the-go with runtime final analysis. Execution time improved by 5 to 12%. Singleton objects 30 % fewer null-checks erhardt@cs.fau.de The final Frontier (JTRES 2014) Evaluation 14

39 SPiCboardTest Test application Evaluation board for teaching JOSEK OS Variant Flash RAM Baseline AVR ATmega32 + 1arrays MHz, KiB + flash allocation flash, 2 KiB SRAM Flash RAM Baseline + constant arrays + flash allocation erhardt@cs.fau.de The final Frontier (JTRES 2014) Evaluation 15

40 Conclusion Summary Effectively-final analysis Can greatly support optimisations Static initialisation + flash allocation of arrays Improves startup times Conserves precious RAM erhardt@cs.fau.de The final Frontier (JTRES 2014) Conclusion 16

41 Conclusion Summary Effectively-final analysis Can greatly support optimisations Static initialisation + flash allocation of arrays Improves startup times Conserves precious RAM Outlook Permit programmer intervention through annotations Cross-check against code to detect contradictions Exploit knowledge about target platform (e.g. memory map) erhardt@cs.fau.de The final Frontier (JTRES 2014) Conclusion 16

A JVM for Soft-Error-Prone Embedded Systems

A JVM for Soft-Error-Prone Embedded Systems A JVM for Soft-Error-Prone Embedded Systems Isabella S)lkerich, Michael Strotz, Christoph Erhardt, Mar7n Hoffmann, Daniel Lohmann, Fabian Scheler, Wolfgang Schröder- Preikschat Department of Computer Science

More information

KESO Functional Safety and the Use of Java in Embedded Systems

KESO Functional Safety and the Use of Java in Embedded Systems KESO Functional Safety and the Use of Java in Embedded Systems Isabella S1lkerich, Bernhard Sechser Embedded Systems Engineering Kongress 05.12.2012 Lehrstuhl für Informa1k 4 Verteilte Systeme und Betriebssysteme

More information

The Use of Java in the Context of AUTOSAR 4.0

The Use of Java in the Context of AUTOSAR 4.0 The Use of Java in the Context of AUTOSAR 4.0 Expectations and Possibilities Christian Wawersich cwh@methodpark.de MethodPark Software AG, Germany Isabella Thomm Michael Stilkerich {ithomm,stilkerich}@cs.fau.de

More information

KESO. An Open-Source Multi-JVM for Deeply Embedded Systems

KESO. An Open-Source Multi-JVM for Deeply Embedded Systems KESO An Open-Source Multi-JVM for Deeply Embedded Systems Isabella Thomm Michael Stilkerich Christian Wawersich Wolfgang Schröder-Preikschat {ithomm,stilkerich,wawi,wosch}@cs.fau.de Friedrich-Alexander

More information

Cooperative Memory Management in Embedded Systems

Cooperative Memory Management in Embedded Systems ooperative Memory Management in Embedded Systems, Philip Taffner, hristoph Erhardt, hris7an Dietrich, Michael S7lkerich Department of omputer Science 4 Distributed Systems and Opera7ng Systems 1 2 Motivation

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

A JVM for Soft-Error-Prone Embedded Systems

A JVM for Soft-Error-Prone Embedded Systems A JVM for Soft-Error-Prone Embedded Systems Isabella Stilkerich Michael Strotz Christoph Erhardt Martin Hoffmann Daniel Lohmann Fabian Scheler Wolfgang Schröder-Preikschat Friedrich-Alexander University

More information

Running class Timing on Java HotSpot VM, 1

Running class Timing on Java HotSpot VM, 1 Compiler construction 2009 Lecture 3. A first look at optimization: Peephole optimization. A simple example A Java class public class A { public static int f (int x) { int r = 3; int s = r + 5; return

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Field Analysis. Last time Exploit encapsulation to improve memory system performance

Field Analysis. Last time Exploit encapsulation to improve memory system performance Field Analysis Last time Exploit encapsulation to improve memory system performance This time Exploit encapsulation to simplify analysis Two uses of field analysis Escape analysis Object inlining April

More information

Compiler construction 2009

Compiler construction 2009 Compiler construction 2009 Lecture 3 JVM and optimization. A first look at optimization: Peephole optimization. A simple example A Java class public class A { public static int f (int x) { int r = 3; int

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems

The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems The Perfect Getaway: Using Escape Analysis in Embedded Real-Time Systems ISABELLA STILKERICH, CLEMENS LANG, CHRISTOPH ERHARDT, CHRISTIAN BAY, and MICHAEL STILKERICH, Friedrich-Alexander-University Erlangen-Nuremberg

More information

JamaicaVM Java for Embedded Realtime Systems

JamaicaVM Java for Embedded Realtime Systems JamaicaVM Java for Embedded Realtime Systems... bringing modern software development methods to safety critical applications Fridtjof Siebert, 25. Oktober 2001 1 Deeply embedded applications Examples:

More information

Memory Management: The Details

Memory Management: The Details Lecture 10 Memory Management: The Details Sizing Up Memory Primitive Data Types Complex Data Types byte: char: short: basic value (8 bits) 1 byte 2 bytes Pointer: platform dependent 4 bytes on 32 bit machine

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages CSE 307: Principles of Programming Languages Variables and Constants R. Sekar 1 / 22 Topics 2 / 22 Variables and Constants Variables are stored in memory, whereas constants need not be. Value of variables

More information

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) COMP 412 FALL 2017 Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) Copyright 2017, Keith D. Cooper & Zoran Budimlić, all rights reserved. Students enrolled in Comp 412 at Rice

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 Spring 2017 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

LANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING

LANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING Technical Disclosure Commons Defensive Publications Series July 03, 2017 LANGUAGE RUNTIME NON-VOLATILE AWARE SWAPPING Follow this and additional works at: http://www.tdcommons.org/dpubs_series Recommended

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309 A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48

More information

StackVsHeap SPL/2010 SPL/20

StackVsHeap SPL/2010 SPL/20 StackVsHeap Objectives Memory management central shared resource in multiprocessing RTE memory models that are used in Java and C++ services for Java/C++ programmer from RTE (JVM / OS). Perspectives of

More information

Important From Last Time

Important From Last Time Important From Last Time Volatile is tricky To write correct embedded C and C++, you have to understand what volatile does and does not do Ø What is the guarantee that it provides? Don t make the 8 mistakes

More information

18-642: Code Style for Compilers

18-642: Code Style for Compilers 18-642: Code Style for Compilers 9/25/2017 1 Anti-Patterns: Coding Style: Language Use Code compiles with warnings Warnings are turned off or over-ridden Insufficient warning level set Language safety

More information

MISRA-C. Subset of the C language for critical systems

MISRA-C. Subset of the C language for critical systems MISRA-C Subset of the C language for critical systems SAFETY-CRITICAL SYSTEMS System is safety-critical if people might die due to software bugs Examples Automobile stability / traction control Medical

More information

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms SE352b Software Engineering Design Tools W3: Programming Paradigms Feb. 3, 2005 SE352b, ECE,UWO, Hamada Ghenniwa SE352b: Roadmap CASE Tools: Introduction System Programming Tools Programming Paradigms

More information

High Performance Computing and Programming, Lecture 3

High Performance Computing and Programming, Lecture 3 High Performance Computing and Programming, Lecture 3 Memory usage and some other things Ali Dorostkar Division of Scientific Computing, Department of Information Technology, Uppsala University, Sweden

More information

CA341 - Comparative Programming Languages

CA341 - Comparative Programming Languages CA341 - Comparative Programming Languages David Sinclair Dynamic Data Structures Generally we do not know how much data a program will have to process. There are 2 ways to handle this: Create a fixed data

More information

Estimating the Impact of Heap Liveness Information on Space Consumption in Java

Estimating the Impact of Heap Liveness Information on Space Consumption in Java Estimating the Impact of Heap Liveness Information on Space Consumption in Java by R. Shaham, E. Kolodner and M. Sagiv first presented at ISSM'02 presentation: Adrian Moos Contents what is this about?

More information

CMPE-013/L. Introduction to C Programming

CMPE-013/L. Introduction to C Programming CMPE-013/L Introduction to C Programming Bryant Wenborg Mairs Spring 2014 What we will cover in 13/L Embedded C on a microcontroller Specific issues with microcontrollers Peripheral usage Reading documentation

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

High-Level Language VMs

High-Level Language VMs High-Level Language VMs Outline Motivation What is the need for HLL VMs? How are these different from System or Process VMs? Approach to HLL VMs Evolutionary history Pascal P-code Object oriented HLL VMs

More information

CS61, Fall 2012 Section 2 Notes

CS61, Fall 2012 Section 2 Notes CS61, Fall 2012 Section 2 Notes (Week of 9/24-9/28) 0. Get source code for section [optional] 1: Variable Duration 2: Memory Errors Common Errors with memory and pointers Valgrind + GDB Common Memory Errors

More information

CPSC 213. Introduction to Computer Systems. Instance Variables and Dynamic Allocation. Unit 1c

CPSC 213. Introduction to Computer Systems. Instance Variables and Dynamic Allocation. Unit 1c CPSC 213 Introduction to Computer Systems Unit 1c Instance Variables and Dynamic Allocation 1 Reading For Next 3 Lectures Companion 2.4.4-2.4.5 Textbook Structures, Dynamic Memory Allocation, Understanding

More information

Exam 1 - (20 points)

Exam 1 - (20 points) Exam 1 - (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth 1 point (unless otherwise stated).

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

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

More information

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

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

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

Chapter 5. Names, Bindings, and Scopes

Chapter 5. Names, Bindings, and Scopes Chapter 5 Names, Bindings, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Scope Scope and Lifetime Referencing Environments Named Constants 1-2 Introduction Imperative

More information

The Mercury project. Zoltan Somogyi

The Mercury project. Zoltan Somogyi The Mercury project Zoltan Somogyi The University of Melbourne Linux Users Victoria 7 June 2011 Zoltan Somogyi (Linux Users Victoria) The Mercury project June 15, 2011 1 / 23 Introduction Mercury: objectives

More information

Glacier: A Garbage Collection Simulation System

Glacier: A Garbage Collection Simulation System Glacier: A Garbage Collection Simulation System Bruno Dufour Sable Research Group McGill University Glacier: A Garbage Collection Simulation System p.1/19 Outline Introduction Objectives & motivation Requirements

More information

SmartHeap for Multi-Core

SmartHeap for Multi-Core SmartHeap for Multi-Core Getting Started and Platform Guide for Linux Version 11.2 SmartHeap and HeapAgent are trademarks of Compuware Corporation. All other trademarks are the property of their respective

More information

Objects Managing a Resource

Objects Managing a Resource Objects Managing a Resource 1 What is a Resource Respects Release/Acquire protocol files (open/close) memory allocation (allocate/free) locks (acquire/release). 2 What is a Resource Objects when constructed,

More information

Dynamic Vertical Memory Scalability for OpenJDK Cloud Applications

Dynamic Vertical Memory Scalability for OpenJDK Cloud Applications Dynamic Vertical Memory Scalability for OpenJDK Cloud Applications Rodrigo Bruno, Paulo Ferreira: INESC-ID / Instituto Superior Técnico, University of Lisbon Ruslan Synytsky, Tetiana Fydorenchyk: Jelastic

More information

Static Analysis of Embedded C

Static Analysis of Embedded C Static Analysis of Embedded C John Regehr University of Utah Joint work with Nathan Cooprider Motivating Platform: TinyOS Embedded software for wireless sensor network nodes Has lots of SW components for

More information

Q Kernel. Thread-Metric RTOS Test Suite. Version Q Kernel is a product of Quasarsoft Ltd.

Q Kernel. Thread-Metric RTOS Test Suite. Version Q Kernel is a product of Quasarsoft Ltd. Version 6.0-3343 Q Kernel is a product of Quasarsoft Ltd. License Q-Kernel-Free Copyright (c) 2013 QuasarSoft Ltd. Q-Kernel-Free is free software: you can redistribute it and/or modify it under the terms

More information

Compiler construction 2009

Compiler construction 2009 Compiler construction 2009 Lecture 6 Some project extensions. Pointers and heap allocation. Object-oriented languages. Module systems. Memory structure Javalette restrictions Only local variables and parameters

More information

Assumptions. History

Assumptions. History Assumptions A Brief Introduction to Java for C++ Programmers: Part 1 ENGI 5895: Software Design Faculty of Engineering & Applied Science Memorial University of Newfoundland You already know C++ You understand

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Garbage Collection Zoran Budimlić (Rice University) Adapted from Keith Cooper s 2014 lecture in COMP 215. Garbage Collection In Beverly Hills...

More information

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++

More information

Expressing high level optimizations within LLVM. Artur Pilipenko

Expressing high level optimizations within LLVM. Artur Pilipenko Expressing high level optimizations within LLVM Artur Pilipenko artur.pilipenko@azul.com This presentation describes advanced development work at Azul Systems and is for informational purposes only. Any

More information

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8 Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns

More information

Program SoC using C Language

Program SoC using C Language Program SoC using C Language 1 Module Overview General understanding of C, program compilation, program image, data storage, data type, and how to access peripherals using C language; Program SoC using

More information

A High Integrity Distributed Deterministic Java Environment. WORDS 2002 January 7, San Diego CA

A High Integrity Distributed Deterministic Java Environment. WORDS 2002 January 7, San Diego CA A High Integrity Distributed Deterministic Java Environment WORDS 2002 January 7, San Diego CA João Ventura Skysoft Portugal SA Fridtjof Siebert & Andy Walter aicas GmbH James Hunt Forschungszentrum Informatik

More information

References and pointers

References and pointers References and pointers Pointers are variables whose value is a reference, i.e. an address of a store location. Early languages (Fortran, COBOL, Algol 60) had no pointers; added to Fortran 90. In Pascal,

More information

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Department of Computer Science Why C? Low-level Direct access to memory WYSIWYG (more or less) Effectively

More information

Software Speculative Multithreading for Java

Software Speculative Multithreading for Java Software Speculative Multithreading for Java Christopher J.F. Pickett and Clark Verbrugge School of Computer Science, McGill University {cpicke,clump}@sable.mcgill.ca Allan Kielstra IBM Toronto Lab kielstra@ca.ibm.com

More information

CS32 Discussion Sec.on 1B Week 2. TA: Zhou Ren

CS32 Discussion Sec.on 1B Week 2. TA: Zhou Ren CS32 Discussion Sec.on 1B Week 2 TA: Zhou Ren Agenda Copy Constructor Assignment Operator Overloading Linked Lists Copy Constructors - Motivation class School { public: }; School(const string &name); string

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2017 Lecture 3a Andrew Tolmach Portland State University 1994-2017 Binding, Scope, Storage Part of being a high-level language is letting the programmer name things: variables

More information

CS 261 Fall Mike Lam, Professor. Virtual Memory

CS 261 Fall Mike Lam, Professor. Virtual Memory CS 261 Fall 2016 Mike Lam, Professor Virtual Memory Topics Operating systems Address spaces Virtual memory Address translation Memory allocation Lingering questions What happens when you call malloc()?

More information

Microcontroller VU

Microcontroller VU 136 182.694 Microcontroller VU Kyrill Winkler SS 2014 Featuring Today: Structured C Programming Weekly Training Objective Already done 3.1.1 C demo program 3.1.3 Floating point operations 3.3.2 Interrupts

More information

<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone

<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone Oleg Pliss Pavel Petroshenko Agenda Introduction to Monty JVM Motivation

More information

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson Virtual Memory I CSE 35 Spring 27 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Midterms Graded If you did

More information

New Java performance developments: compilation and garbage collection

New Java performance developments: compilation and garbage collection New Java performance developments: compilation and garbage collection Jeroen Borgers @jborgers #jfall17 Part 1: New in Java compilation Part 2: New in Java garbage collection 2 Part 1 New in Java compilation

More information

#include <iostream> #include <cstdlib>

#include <iostream> #include <cstdlib> Classes and Objects Classes The structure data type can be used in both C and C++ Usually a structure is used to store just data, however it can also be used to store functions that can work on the data.

More information

Automated Application of Fault Tolerance Mechanisms in a Component-Based System

Automated Application of Fault Tolerance Mechanisms in a Component-Based System Automated Application of Fault Tolerance Mechanisms in a Component-Based System Isabella Thomm Michael Stilkerich Rüdiger Kapitza Daniel Lohmann Wolfgang Schröder-Preikschat {ithomm,stilkerich,rrkapitz,lohmann,wosch}@cs.fau.de

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

Concurrency in Object Oriented Programs 1. Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter

Concurrency in Object Oriented Programs 1. Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter Concurrency in Object Oriented Programs 1 Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter Outline Concurrency: the Future of Computing Java Concurrency Thread Safety

More information

6. Pointers, Structs, and Arrays. 1. Juli 2011

6. Pointers, Structs, and Arrays. 1. Juli 2011 1. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 50 Outline Recapitulation Pointers Dynamic Memory Allocation Structs Arrays Bubble Sort Strings Einführung

More information

Grafting Functional Support on Top of an Imperative Language

Grafting Functional Support on Top of an Imperative Language Grafting Functional Support on Top of an Imperative Language How D 2.0 implements immutability and functional purity Andrei Alexandrescu Grafting Functional Support on Top of an Imperative Language p.

More information

Memory and Addresses. Pointers in C. Memory is just a sequence of byte-sized storage devices.

Memory and Addresses. Pointers in C. Memory is just a sequence of byte-sized storage devices. Memory and Addresses Memory is just a sequence of byte-sized storage devices. 1 The bytes are assigned numeric addresses, starting with zero, just like the indexing of the cells of an array. It is the

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

Lecture 15 Garbage Collection

Lecture 15 Garbage Collection Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:

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

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites: C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

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

Creating a String Data Type in C

Creating a String Data Type in C C Programming Creating a String Data Type in C For this assignment, you will use the struct mechanism in C to implement a data type that models a character string: struct _String { char data; dynamically-allocated

More information

Recap: Pointers. int* int& *p &i &*&* ** * * * * IFMP 18, M. Schwerhoff

Recap: Pointers. int* int& *p &i &*&* ** * * * * IFMP 18, M. Schwerhoff Recap: Pointers IFMP 18, M. Schwerhoff int* int& *p &i &*&* ** * * * * A 0 A 1 A 2 A 3 A 4 A 5 A 0 A 1 A 2 A 3 A 4 A 5 5 i int* p; A 0 A 1 A 2 A 3 A 4 A 5 5 i p int* p; p = &i; A 0 A 1 A 2 A 3 A 4 A 5

More information

6. Pointers, Structs, and Arrays. March 14 & 15, 2011

6. Pointers, Structs, and Arrays. March 14 & 15, 2011 March 14 & 15, 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 47 Outline Recapitulation Pointers Dynamic Memory Allocation Structs Arrays Bubble Sort Strings Einführung

More information

Declarations and Access Control SCJP tips

Declarations and Access Control  SCJP tips Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for

More information

University of Wisconsin-Madison

University of Wisconsin-Madison Evolving RPC for Active Storage Muthian Sivathanu Andrea C. Arpaci-Dusseau Remzi H. Arpaci-Dusseau University of Wisconsin-Madison Architecture of the future Everything is active Cheaper, faster processing

More information

September 10,

September 10, September 10, 2013 1 Bjarne Stroustrup, AT&T Bell Labs, early 80s cfront original C++ to C translator Difficult to debug Potentially inefficient Many native compilers exist today C++ is mostly upward compatible

More information

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young Generational GC 1 Review Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young 2 Single-partition scanning Stack Heap Partition #1 Partition

More information

Java and C CSE 351 Spring

Java and C CSE 351 Spring Java and C CSE 351 Spring 2018 https://xkcd.com/801/ Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq

More information

Fiji VM Safety Critical Java

Fiji VM Safety Critical Java Fiji VM Safety Critical Java Filip Pizlo, President Fiji Systems Inc. Introduction Java is a modern, portable programming language with wide-spread adoption. Goal: streamlining debugging and certification.

More information

Special Topics: Programming Languages

Special Topics: Programming Languages Lecture #23 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 23 Lecture #23 1 Slide 1 Java: History Spring 1990 April 1991: Naughton, Gosling and Sheridan (

More information

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia Memory Allocation II CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:

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

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel Alexander Züpke, Marc Bommert, Daniel Lohmann alexander.zuepke@hs-rm.de, marc.bommert@hs-rm.de, lohmann@cs.fau.de Motivation Automotive and Avionic industry

More information

the gamedesigninitiative at cornell university Lecture 9 Memory Management

the gamedesigninitiative at cornell university Lecture 9 Memory Management Lecture 9 Gaming Memory Constraints Redux Wii-U Playstation 4 2GB of RAM 1GB dedicated to OS Shared with GPGPU 8GB of RAM Shared GPU, 8-core CPU OS footprint unknown 2 Two Main Concerns with Memory Getting

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008 Dynamic Storage Allocation CS 44: Operating Systems Spring 2 Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need to grow or shrink. Dynamic

More information

struct Properties C struct Types

struct Properties C struct Types struct Properties 1 The C struct mechanism is vaguely similar to the Java/C++ class mechanisms: - supports the creation of user-defined data types - struct types encapsulate data members struct Location

More information

D Programming Language

D Programming Language Group 14 Muazam Ali Anil Ozdemir D Programming Language Introduction and Why D? It doesn t come with a religion this is written somewhere along the overview of D programming language. If you actually take

More information

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep CS842: Automatic Memory Management and Garbage Collection Mark and sweep 1 Schedule M W Sept 14 Intro/Background Basics/ideas Sept 21 Allocation/layout GGGGC Sept 28 Mark/Sweep Mark/Sweep cto 5 Copying

More information

Memory Usage. Chapter 23

Memory Usage. Chapter 23 C23621721.fm Page 280 Wednesday, January 12, 2005 10:52 PM Chapter 23 Memory Usage The garbage collector is one of the most sophisticated pieces of the Microsoft.NET Framework architecture. Each time an

More information