Java in High-Performance Computing

Size: px
Start display at page:

Download "Java in High-Performance Computing"

Transcription

1 Java in High-Performance Computing Dawid Weiss Carrot Search Institute of Computing Science, Poznan University of Technology GeeCon Poznań, 05/2010

2

3

4 Learn from the mistakes of others. You can t live long enough to make them all yourself. Eleanor Roosevelt

5

6 Talk outline What is High performance? What is Java? Measuring performance (benchmarking). HPPC library.

7 Talk outline What is High performance? What is Java? Measuring performance (benchmarking). HPPC library. Crosscutting: (un?)common pitfalls and performance killers. Some HotSpot internals.

8 Divide-and-conquer style algorithm for (Example e : examples) { e.hasquiz()? e.showquiz() : e.showcode(); e.explain(); e.deriveconclusions(); }

9

10 PART I High Performance Computing

11 High-performance computing (HPC) uses supercomputers and computer clusters to solve advanced computation problems. Wikipedia

12 Is Java faster than C/C++? The short answer is: it depends. Cliff Click

13 It s usually hard to make a fast program run faster.

14 It s usually hard to make a fast program run faster. It s easy to make a slow program run even slower.

15 It s usually hard to make a fast program run faster. It s easy to make a slow program run even slower. It s easy to make fast hardware run slow.

16 For now, HPC limited allowed computation time, constrained resources (hardware, memory).

17 For now, HPC limited allowed computation time, constrained resources (hardware, memory). Good HPC software no (obvious) flaws.

18 PART II What is Java? (Recall: Is Java faster than C/C++?)

19 Example 1 public void testsum1() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum1(i, i); result = sum; } public void testsum2() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum2(i, i); result = sum; }

20 Example 1 public void testsum1() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum1(i, i); result = sum; } public void testsum2() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum2(i, i); result = sum; } where the body of sum1 and sum2 sums arguments and returns the result and COUNT is significantly large...

21 sun VM sum1 sum2

22 VM sum1 sum2 sun

23 VM sum1 sum2 sun sun

24 VM sum1 sum2 sun sun sun

25 VM sum1 sum2 sun sun sun ibm-1.6.2

26 VM sum1 sum2 sun sun sun ibm jrockit

27 VM sum1 sum2 sun sun sun ibm jrockit harmony-r917296

28 VM sum1 sum2 sun sun sun ibm jrockit harmony-r (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200).

29 VM sum1 sum2 sum3 sum4 sun sun sun ibm jrockit harmony-r (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200).

30 int sum1(int a, int b) { return a + b; } Integer sum2(integer a, Integer b) { return a + b; } Integer sum2(integer a, Integer b) { return Integer.valueOf( a.intvalue() + b.intvalue()); }

31 int sum3(int... args) { int sum = 0; for (int i = 0; i < args.length; i++) sum += args[i]; return sum; } Integer sum4(integer... args) { int sum = 0; for (int i = 0; i < args.length; i++) { sum += args[i]; } return sum; } Integer sum4(integer [] args) { //... }

32 Conclusions Syntactic sugar may be costly. Primitive types are fast. Large differences between different VMs.

33

34 Example 2 Write once, run anywhere!

35

36

37

38 But it s the same VM!

39 It works on my machine!

40 private static boolean ready; public static void startthread() { new Thread() { public void run() { try { sleep(2000); } catch (Exception e) { /* ignore */ } System.out.println("Marking loop exit."); ready = true; } }.start(); } public static void main(string[] args) { startthread(); System.out.println("Entering the loop..."); while (!ready) { // Do nothing. } System.out.println("Done, I left the loop!"); }

41 while (!ready) { // Do nothing. }? boolean r = ready; while (!r) { // Do nothing. }

42 while (!ready) { // Do nothing. }? boolean r = ready; while (!r) { // Do nothing. } In most cases true, from a JMM perspective.

43 JVM Internals...

44

45

46

47 C1: fast not (much) optimization C2: slow(er) than C1 a lot of JMM-allowed optimizations

48 There are hundreds of JVM tuning/diagnostic switches.

49 My personal favorite:

50 Conclusions Bytecode is far from what is executed. A lot going on under the (VM) hood. Bad code may work, but will eventually crash. HotSpot-level optimizations are good.

51 Conclusions Bytecode is far from what is executed. A lot going on under the (VM) hood. Bad code may work, but will eventually crash. HotSpot-level optimizations are good. If there is a bug in the HotSpot compiler...

52

53

54

55 Any other diversifying factors?

56

57 J2ME more VM vendors, hardware diversity, software and hardware quirks.

58

59 Non-JVM target platforms Dalvik GWT IKVM

60

61 Conclusions There is no single Java performance model. Performance depends on the VM, environment, class library, hardware. Apply benchmark-and-correct cycle.

62 Benchmarking

63 Example 3 public void testsum1() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum1(i, i); result = sum; } public void testsum1_2() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += sum1(i, i); }

64 sun VM sum1 sum1_2

65 VM sum1 sum1_2 sun

66 VM sum1 sum1_2 sun

67 VM sum1 sum1_2 sun sun sun ibm jrockit harmony-r (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200).

68

69 java -server -XX:+PrintOptoAssembly -XX:+PrintCompilation...

70 java -server -XX:+PrintOptoAssembly -XX:+PrintCompilation... - method holder: com/dawidweiss/geecon2010/example03 - access: 0xc public - name: testsum1_ pushq rbp subq rsp, #16 # Create frame nop # nop for patch_verified_entry 016 addq rsp, 16 # Destroy frame popq rbp testl rax, [rip + #offset_to_poll_page] # Safepoint: poll for GC 021 ret

71 Conclusions Benchmarks must be executed to provide feedback. HotSpot is smart and effective at removing dead code.

72 Example public void testadd1() { int sum = 0; for (int i = 0; i < COUNT; i++) { sum += add1(i); } guard = sum; } public int add1(int i) { return i + 1; } Note add1 is virtual.

73 switch testadd1 -XX:+Inlining -XX:+PrintInlining XX:-Inlining? (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200, JRE 1.7b80-debug).

74 switch testadd1 -XX:+Inlining -XX:+PrintInlining XX:-Inlining 0.45 (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200, JRE 1.7b80-debug).

75 Most Java calls are monomorphic.

76 HotSpot adjusts to megamorphic calls automatically.

77 Example 5 abstract class Superclass { abstract int call(); } class Sub1 extends Superclass { int call() { return 1; } } class Sub2 extends Superclass { int call() { return 2; } } class Sub3 extends Superclass { int call() { return 3; } } Superclass[] mixed = initwithrandominstances(10000); Superclass[] solid = public void testmonomorphic() { int sum = 0; int m = solid.length; for (int i = 0; i < COUNT; i++) sum += solid[i % m].call(); guard = sum; public void testmegamorphic() { int sum = 0; int m = mixed.length; for (int i = 0; i < COUNT; i++) sum += mixed[i % m].call(); guard = sum; }

78 VM monomorphic megamorphic sun sun sun ibm jrockit harmony-r (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200).

79 Example public void testbitcount1() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += Integer.bitCount(i); guard = sum; public void testbitcount2() { int sum = 0; for (int i = 0; i < COUNT; i++) sum += bitcount(i); guard = sum; } /* Copied from * {@link Integer#bitCount} */ static int bitcount(int i) { // HD, Figure 5-2 i = i - ((i >>> 1) & 0x ); i = (i & 0x ) + ((i >>> 2) & 0x ); i = (i + (i >>> 4)) & 0x0f0f0f0f; i = i + (i >>> 8); i = i + (i >>> 16); return i & 0x3f; }

80 VM testbitcount1 testbitcount2 sun sun b (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200).

81 VM testbitcount1 testbitcount2 sun sun b (averages in sec., 10 measured rounds, 5 warmup, 64-bit Ubuntu, dual-core AMD Athlon 5200). VM testbitcount1 testbitcount2 sun sun b (averages in sec., 10 measured rounds, 5 warmup, 64-bit Windows 7, Intel I7 860).

82 ... -XX:+PrintInlining...

83 ... -XX:+PrintInlining Inlining intrinsic _bitcount_i at bci:9 in..example06::testbitcount1 Inlining intrinsic _bitcount_i at bci:9 in..example06::testbitcount1 Inlining intrinsic _bitcount_i at bci:9 in..example06::testbitcount1 Example06.testBitCount1: [measured 10 out of 15 rounds] round: 0.07 [ ], round.gc: 0.00 [+- 9 com.dawidweiss.geecon2010.example06::bitcount inline 9 com.dawidweiss.geecon2010.example06::bitcount inline 9 com.dawidweiss.geecon2010.example06::bitcount inline (hot) Example06.testBitCount2: [measured 10 out of 15 rounds] round: 0.32 [ ], round.gc: 0.00 [ ]...

84 ... -XX:+PrintOptoAssembly...

85 ... -XX:+PrintOptoAssembly... {method} - klass: {other class} - method holder: com/dawidweiss/geecon2010/example06 - name: testbitcount1... 0c2 B13: # B12 B14 <- B8 B12 Loop: B13-B12 inner stride:... 0c2 movl R10, RDX # spill... 0e1 movl [rsp + #40], R11 # spill 0e6 popcnt R8, R8... 0f5 addl R9, #7 # int 0f9 popcnt R11, R11 0fe popcnt RCX, R9

86

87

88 Conclusions Benchmarks must be statistically sound. averages, variance, min, max, warm-up phase Account for HotSpot optimisations. Account for hardware differences. test-on-target Use domain data and real scenarios. Inspect suspicious output with debug JVM. See more: Cliff Click,

89 HPPC High Performance Primitive Collections

90 Motivation Primitive types: fast and memory-friendly. Optional assertions. Single-threaded. No fail-fast. Fast, fast, fast iterators, with no GC overhead. Open internals (explicit implementation). Programmers know what they re doing.

91 Why not JCF? public interface List<E> extends Collection<E> { boolean contains(object o); // [-] contract-enforced methods Iterator<E> iterator(); // [-] iterators over primitive types? Object[] toarray(); // [-] troublesome covariants...

92 Friendly Competition fastutil PCJ GNU Trove Apache Mahout (ported COLT) Apache Primitive Collections All of these have pros and cons and deal with JCF compatibility somehow.

93 Iterators in fastutil or PCJ interface IntIterator extends Iterator<Integer> { // Primitive-specific method int nextint(); }

94 Iterators in HPPC public final class IntCursor { public int index; public int value; } public class IntArrayList extends Iterable<IntCursor> { Iterator<IntCursor> iterator() {... } }

95 Iterating over list elements in HPPC for (IntCursor c : list) { System.out.println(c.index + ": " + c.value); }

96 Iterating over list elements in HPPC for (IntCursor c : list) { System.out.println(c.index + ": " + c.value); }...or list.foreach(new IntProcedure() { public void apply(int value) { System.out.println(value); } });

97 Iterating over list elements in HPPC for (IntCursor c : list) { System.out.println(c.index + ": " + c.value); }...or list.foreach(new IntProcedure() { public void apply(int value) { System.out.println(value); } });...or final int [] buffer = list.buffer; final int size = list.size(); for (int i = 0; i < size; i++) { System.out.println(i + ": " + buffer[i]); }

98 The fastest one?

99

100

101 What s in HPPC?

102

103 Open implementation is good.

104 /** * Applies a supplemental hash function to a given * hashcode, which defends against poor quality * hash functions. [...] */ static int hash(int h) { // This function ensures that hashcodes that differ only by // constant multiples at each bit position have a bounded // number of collisions (approximately 8 at default load factor). h ^= (h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); } HashMap rehashes your (carefully crafted) hash code.

105 HPPC approach (example): public class LongIntOpenHashMap implements LongIntMap { //... public LongIntOpenHashMap(int initialcapacity, float loadfactor, LongHashFunction keyhashfunction, IntHashFunction valuehashfunction) { //... } Defaults: LongMurmurHash, IntHashFunction.

106 Example 7 Frequency count of character bigrams in a given text.

107 HPPC: final char [] CHARS = DATA; final IntIntOpenHashMap counts = new IntIntOpenHashMap(); for (int i = 0; i < CHARS.length - 1; i++) { counts.putoradd((chars[i] << 16 CHARS[i + 1]), 1, 1); } JCF, boxed integer types. final Integer currentcount = map.get(bigram); map.put(bigram, currentcount == null? 1 : currentcount + 1); JCF, with IntHolder (mutable value object). GNU Trove map.adjustorputvalue(bigram, 1, 1); fastutil, OpenHashMap and LinkedOpenHashMap map.put(bigram, map.get(bigram) + 1); PCJ, OpenHashMap and ChainedHashMap

108

109

110 Is Java faster than C/C++? The short answer is: it depends. Cliff Click

111 Example 8 The same algorithm for building a DFSA automaton accepting a set of strings. Input: strings, 158M of text.

112 Example 8 The same algorithm for building a DFSA automaton accepting a set of strings. Input: strings, 158M of text. real user sys gcc -O2 java 1.6.0_20-64

113 Example 8 The same algorithm for building a DFSA automaton accepting a set of strings. Input: strings, 158M of text. gcc -O2 real s user s sys 0.240s java 1.6.0_20-64

114 Example 8 The same algorithm for building a DFSA automaton accepting a set of strings. Input: strings, 158M of text. gcc -O2 java 1.6.0_20-64 real s s user s s sys 0.240s 0.840s

115 Summary and Conclusions

116 Performance checklist (sanity check) Algorithms, algorithms, algorithms. Proper data structures. Spurious GC activity. Memory barriers in tight loops. CPU cache utilization. Low-level, hotspot-specific code structuring.

117 HPPC and junit-benchmarks are at:

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified)

More information

Java Coding Practices for Improved Application Performance

Java Coding Practices for Improved Application Performance 1 Java Coding Practices for Improved Application Performance Lloyd Hagemo Senior Director Application Infrastructure Management Group Candle Corporation In the beginning, Java became the language of the

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.

More information

CS3813 Performance Monitoring Project

CS3813 Performance Monitoring Project CS3813 Performance Monitoring Project Owen Kaser October 8, 2014 1 Introduction In this project, you should spend approximately 20 hours to experiment with Intel performance monitoring facilities, and

More information

Crash Course in Java

Crash Course in Java Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is

More information

14/05/2013 Ed Merks EDL V1.0 1

14/05/2013 Ed Merks EDL V1.0 1 14/05/2013 Ed Merks EDL V1.0 1 Java Performance is Complex Write once run everywhere Java is slow because it s interpreted No, there are Just In Time (JIT) compilers Different hardware and platforms Different

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Can You Trust Your JVM Diagnostic Tools?

Can You Trust Your JVM Diagnostic Tools? Can You Trust Your JVM Diagnostic Tools? Isaac Sjoblom, Tim S. Snyder, and Elena Machkasova Computer Science Discipline University of Minnesota Morris Morris, MN 56267 sjobl014@umn.edu, snyde479@umn.edu,

More information

Extreme Performance with Java

Extreme Performance with Java Extreme Performance with Java QCon NYC - June 2012 Charlie Hunt Architect, Performance Engineering Salesforce.com sfdc_ppt_corp_template_01_01_2012.ppt In a Nutshell What you need to know about a modern

More information

Tail call elimination. Michel Schinz

Tail call elimination. Michel Schinz Tail call elimination Michel Schinz Tail calls and their elimination Loops in functional languages Several functional programming languages do not have an explicit looping statement. Instead, programmers

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming Java has become enormously popular. Java s rapid rise and wide acceptance can be traced to its design

More information

CSC230 Getting Starting in C. Tyler Bletsch

CSC230 Getting Starting in C. Tyler Bletsch CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly

More information

Use of profilers for studying Java dynamic optimizations

Use of profilers for studying Java dynamic optimizations Use of profilers for studying Java dynamic optimizations Kevin Arhelger, Fernando Trinciante, Elena Machkasova Computer Science Discipline University of Minnesota Morris Morris MN, 56267 arhel005@umn.edu,

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Java (Micro) Performance Measuring

Java (Micro) Performance Measuring Java (Micro) Performance Measuring trendscope.com How to measure and test the performance of Java applications Java (Micro) Performance Measuring Thomas Uhrig Akt. Themen des Software-Engineerings 1 of

More information

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz 2007 03 16

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz 2007 03 16 Advanced compiler construction Michel Schinz 2007 03 16 General course information Teacher & assistant Course goals Teacher: Michel Schinz Michel.Schinz@epfl.ch Assistant: Iulian Dragos INR 321, 368 64

More information

Java Programming Fundamentals

Java Programming Fundamentals Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few

More information

Validating Java for Safety-Critical Applications

Validating Java for Safety-Critical Applications Validating Java for Safety-Critical Applications Jean-Marie Dautelle * Raytheon Company, Marlborough, MA, 01752 With the real-time extensions, Java can now be used for safety critical systems. It is therefore

More information

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui

More information

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Programming Languages

Programming Languages Programming Languages In the beginning To use a computer, you needed to know how to program it. Today People no longer need to know how to program in order to use the computer. To see how this was accomplished,

More information

The Fundamentals of Tuning OpenJDK

The Fundamentals of Tuning OpenJDK The Fundamentals of Tuning OpenJDK OSCON 2013 Portland, OR Charlie Hunt Architect, Performance Engineering Salesforce.com sfdc_ppt_corp_template_01_01_2012.ppt In a Nutshell What you need to know about

More information

Lecture 3: Evaluating Computer Architectures. Software & Hardware: The Virtuous Cycle?

Lecture 3: Evaluating Computer Architectures. Software & Hardware: The Virtuous Cycle? Lecture 3: Evaluating Computer Architectures Announcements - Reminder: Homework 1 due Thursday 2/2 Last Time technology back ground Computer elements Circuits and timing Virtuous cycle of the past and

More information

Software Engineering Techniques

Software Engineering Techniques Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary

More information

Optimizing Generation of Object Graphs in Java PathFinder

Optimizing Generation of Object Graphs in Java PathFinder Optimizing Generation of Object Graphs in Java PathFinder Milos Gligoric, Tihomir Gvero, Steven Lauterburg, Darko Marinov, Sarfraz Khurshid JPF Workshop 1.5.8 Bugs Six Decades Ago 1947: Harvard Mark II

More information

C# and Other Languages

C# and Other Languages C# and Other Languages Rob Miles Department of Computer Science Why do we have lots of Programming Languages? Different developer audiences Different application areas/target platforms Graphics, AI, List

More information

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Introduction to Object-Oriented Programming Programs and Methods Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Programs and Methods 1 / 8 The Anatomy of a Java Program It is customary

More information

Chapter 1 Java Program Design and Development

Chapter 1 Java Program Design and Development presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented

More information

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders 1.00 Lecture 1 Course Overview Introduction to Java Reading for next time: Big Java: 1.1-1.7 Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

More information

Language Based Virtual Machines... or why speed matters. by Lars Bak, Google Inc

Language Based Virtual Machines... or why speed matters. by Lars Bak, Google Inc Language Based Virtual Machines... or why speed matters by Lars Bak, Google Inc Agenda Motivation for virtual machines HotSpot V8 Dart What I ve learned Background 25+ years optimizing implementations

More information

Effective Java Programming. efficient software development

Effective Java Programming. efficient software development Effective Java Programming efficient software development Structure efficient software development what is efficiency? development process profiling during development what determines the performance of

More information

Practical Performance Understanding the Performance of Your Application

Practical Performance Understanding the Performance of Your Application Neil Masson IBM Java Service Technical Lead 25 th September 2012 Practical Performance Understanding the Performance of Your Application 1 WebSphere User Group: Practical Performance Understand the Performance

More information

Optimising Cloud Computing with SBSE

Optimising Cloud Computing with SBSE Optimising Cloud Computing with SBSE David R. White & Jeremy Singer {david.r.white, jeremy.singer}@glasgow.ac.uk University of Glasgow Monday 25 July 2011 OUTLINE VIRTUAL MACHINES OPPORTUNITIES FOR SBSE

More information

Automated Repair of Binary and Assembly Programs for Cooperating Embedded Devices

Automated Repair of Binary and Assembly Programs for Cooperating Embedded Devices Automated Repair of Binary and Assembly Programs for Cooperating Embedded Devices Eric Schulte 1 Jonathan DiLorenzo 2 Westley Weimer 2 Stephanie Forrest 1 1 Department of Computer Science University of

More information

Lecture 1 Introduction to Android

Lecture 1 Introduction to Android These slides are by Dr. Jaerock Kwon at. The original URL is http://kettering.jrkwon.com/sites/default/files/2011-2/ce-491/lecture/alecture-01.pdf so please use that instead of pointing to this local copy

More information

TESTING WITH JUNIT. Lab 3 : Testing

TESTING WITH JUNIT. Lab 3 : Testing TESTING WITH JUNIT Lab 3 : Testing Overview Testing with JUnit JUnit Basics Sample Test Case How To Write a Test Case Running Tests with JUnit JUnit plug-in for NetBeans Running Tests in NetBeans Testing

More information

2 2011 Oracle Corporation Proprietary and Confidential

2 2011 Oracle Corporation Proprietary and Confidential The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material,

More information

Java Performance. Adrian Dozsa TM-JUG 18.09.2014

Java Performance. Adrian Dozsa TM-JUG 18.09.2014 Java Performance Adrian Dozsa TM-JUG 18.09.2014 Agenda Requirements Performance Testing Micro-benchmarks Concurrency GC Tools Why is performance important? We hate slow web pages/apps We hate timeouts

More information

Metrics for Success: Performance Analysis 101

Metrics for Success: Performance Analysis 101 Metrics for Success: Performance Analysis 101 February 21, 2008 Kuldip Oberoi Developer Tools Sun Microsystems, Inc. 1 Agenda Application Performance Compiling for performance Profiling for performance

More information

Building Applications Using Micro Focus COBOL

Building Applications Using Micro Focus COBOL Building Applications Using Micro Focus COBOL Abstract If you look through the Micro Focus COBOL documentation, you will see many different executable file types referenced: int, gnt, exe, dll and others.

More information

An Overview of Java. overview-1

An Overview of Java. overview-1 An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2

More information

General Introduction

General Introduction Managed Runtime Technology: General Introduction Xiao-Feng Li (xiaofeng.li@gmail.com) 2012-10-10 Agenda Virtual machines Managed runtime systems EE and MM (JIT and GC) Summary 10/10/2012 Managed Runtime

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

CPLEX Tutorial Handout

CPLEX Tutorial Handout CPLEX Tutorial Handout What Is ILOG CPLEX? ILOG CPLEX is a tool for solving linear optimization problems, commonly referred to as Linear Programming (LP) problems, of the form: Maximize (or Minimize) c

More information

Tutorial: Getting Started

Tutorial: Getting Started 9 Tutorial: Getting Started INFRASTRUCTURE A MAKEFILE PLAIN HELLO WORLD APERIODIC HELLO WORLD PERIODIC HELLO WORLD WATCH THOSE REAL-TIME PRIORITIES THEY ARE SERIOUS SUMMARY Getting started with a new platform

More information

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 NOTE: SUN ONE Studio is almost identical with NetBeans. NetBeans is open source and can be downloaded from www.netbeans.org. I

More information

picojava TM : A Hardware Implementation of the Java Virtual Machine

picojava TM : A Hardware Implementation of the Java Virtual Machine picojava TM : A Hardware Implementation of the Java Virtual Machine Marc Tremblay and Michael O Connor Sun Microelectronics Slide 1 The Java picojava Synergy Java s origins lie in improving the consumer

More information

Multi-core architectures. Jernej Barbic 15-213, Spring 2007 May 3, 2007

Multi-core architectures. Jernej Barbic 15-213, Spring 2007 May 3, 2007 Multi-core architectures Jernej Barbic 15-213, Spring 2007 May 3, 2007 1 Single-core computer 2 Single-core CPU chip the single core 3 Multi-core architectures This lecture is about a new trend in computer

More information

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Exploiting nginx chunked overflow bug, the undisclosed attack vector Exploiting nginx chunked overflow bug, the undisclosed attack vector Long Le longld@vnsecurity.net About VNSECURITY.NET CLGT CTF team 2 VNSECURITY.NET In this talk Nginx brief introduction Nginx chunked

More information

11.1 inspectit. 11.1. inspectit

11.1 inspectit. 11.1. inspectit 11.1. inspectit Figure 11.1. Overview on the inspectit components [Siegl and Bouillet 2011] 11.1 inspectit The inspectit monitoring tool (website: http://www.inspectit.eu/) has been developed by NovaTec.

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1

Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1 Parrot in a Nutshell Dan Sugalski dan@sidhe.org Parrot in a nutshell 1 What is Parrot The interpreter for perl 6 A multi-language virtual machine An April Fools joke gotten out of hand Parrot in a nutshell

More information

Liferay Portal Performance. Benchmark Study of Liferay Portal Enterprise Edition

Liferay Portal Performance. Benchmark Study of Liferay Portal Enterprise Edition Liferay Portal Performance Benchmark Study of Liferay Portal Enterprise Edition Table of Contents Executive Summary... 3 Test Scenarios... 4 Benchmark Configuration and Methodology... 5 Environment Configuration...

More information

What s Cool in the SAP JVM (CON3243)

What s Cool in the SAP JVM (CON3243) What s Cool in the SAP JVM (CON3243) Volker Simonis, SAP SE September, 2014 Public Agenda SAP JVM Supportability SAP JVM Profiler SAP JVM Debugger 2014 SAP SE. All rights reserved. Public 2 SAP JVM SAP

More information

Using jvmstat and visualgc to Solve Memory Management Problems

Using jvmstat and visualgc to Solve Memory Management Problems Using jvmstat and visualgc to Solve Memory Management Problems java.sun.com/javaone/sf 1 Wally Wedel Sun Software Services Brian Doherty Sun Microsystems, Inc. Analyze JVM Machine Memory Management Problems

More information

Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219

Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing

More information

Holly Cummins IBM Hursley Labs. Java performance not so scary after all

Holly Cummins IBM Hursley Labs. Java performance not so scary after all Holly Cummins IBM Hursley Labs Java performance not so scary after all So... You have a performance problem. What next? Goals After this talk you will: Not feel abject terror when confronted with a performance

More information

02 B The Java Virtual Machine

02 B The Java Virtual Machine 02 B The Java Virtual Machine CS1102S: Data Structures and Algorithms Martin Henz January 22, 2010 Generated on Friday 22 nd January, 2010, 09:46 CS1102S: Data Structures and Algorithms 02 B The Java Virtual

More information

Parallel Processing and Software Performance. Lukáš Marek

Parallel Processing and Software Performance. Lukáš Marek Parallel Processing and Software Performance Lukáš Marek DISTRIBUTED SYSTEMS RESEARCH GROUP http://dsrg.mff.cuni.cz CHARLES UNIVERSITY PRAGUE Faculty of Mathematics and Physics Benchmarking in parallel

More information

Embedded Software Development

Embedded Software Development Linköpings Tekniska Högskola Institutionen för Datavetanskap (IDA), Software and Systems (SaS) TDDI11, Embedded Software 2010-04-22 Embedded Software Development Host and Target Machine Typical embedded

More information

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer How to make the computer understand? Fall 2005 Lecture 15: Putting it all together From parsing to code generation Write a program using a programming language Microprocessors talk in assembly language

More information

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which

More information

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation Mathias Payer, ETH Zurich Motivation Applications often vulnerable to security exploits Solution: restrict application

More information

Troubleshoot the JVM like never before. JVM Troubleshooting Guide. Pierre-Hugues Charbonneau Ilias Tsagklis

Troubleshoot the JVM like never before. JVM Troubleshooting Guide. Pierre-Hugues Charbonneau Ilias Tsagklis Troubleshoot the JVM like never before JVM Troubleshooting Guide Pierre-Hugues Charbonneau Ilias Tsagklis Table of Contents Oracle HotSpot JVM Memory...3 Java HotSpot VM Heap space...3 Java HotSpot VM

More information

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues Zend Server 4.0 Beta 2 Release Announcement Thank you for your participation in the Zend Server 4.0 beta program. Your involvement will help us ensure we best address your needs and deliver even higher

More information

Java Program Coding Standards 4002-217-9 Programming for Information Technology

Java Program Coding Standards 4002-217-9 Programming for Information Technology Java Program Coding Standards 4002-217-9 Programming for Information Technology Coding Standards: You are expected to follow the standards listed in this document when producing code for this class. Whether

More information

aicas Technology Multi Core und Echtzeit Böse Überraschungen vermeiden Dr. Fridtjof Siebert CTO, aicas OOP 2011, 25 th January 2011

aicas Technology Multi Core und Echtzeit Böse Überraschungen vermeiden Dr. Fridtjof Siebert CTO, aicas OOP 2011, 25 th January 2011 aicas Technology Multi Core und Echtzeit Böse Überraschungen vermeiden Dr. Fridtjof Siebert CTO, aicas OOP 2011, 25 th January 2011 2 aicas Group aicas GmbH founded in 2001 in Karlsruhe Focus: Embedded

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Andreas Herrmann. AMD Operating System Research Center

Andreas Herrmann. AMD Operating System Research Center Myth and facts about 64-bit Linux Andreas Herrmann André Przywara AMD Operating System Research Center March 2nd, 2008 Myths... You don't need 64-bit software with less than 3 GB RAM. There are less drivers

More information

Java Crash Course Part I

Java Crash Course Part I Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux

More information

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE INTRODUCTION TO JAVA PROGRAMMING LANGUAGE Today Java programming language is one of the most popular programming language which is used in critical applications like stock market trading system on BSE,

More information

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in

More information

ROBOTICS AND AUTONOMOUS SYSTEMS

ROBOTICS AND AUTONOMOUS SYSTEMS ROBOTICS AND AUTONOMOUS SYSTEMS Simon Parsons Department of Computer Science University of Liverpool LECTURE 3 PROGRAMMING ROBOTS comp329-2013-parsons-lect03 2/50 Today Before the labs start on Monday,

More information

Java Monitoring. Stuff You Can Get For Free (And Stuff You Can t) Paul Jasek Sales Engineer

Java Monitoring. Stuff You Can Get For Free (And Stuff You Can t) Paul Jasek Sales Engineer Java Monitoring Stuff You Can Get For Free (And Stuff You Can t) Paul Jasek Sales Engineer A Bit About Me Current: Past: Pre-Sales Engineer (1997 present) WaveMaker Wily Persistence GemStone Application

More information

HOTPATH VM. An Effective JIT Compiler for Resource-constrained Devices

HOTPATH VM. An Effective JIT Compiler for Resource-constrained Devices HOTPATH VM An Effective JIT Compiler for Resource-constrained Devices based on the paper by Andreas Gal, Christian W. Probst and Michael Franz, VEE 06 INTRODUCTION INTRODUCTION Most important factor: speed

More information

Performance Improvement In Java Application

Performance Improvement In Java Application Performance Improvement In Java Application Megha Fulfagar Accenture Delivery Center for Technology in India Accenture, its logo, and High Performance Delivered are trademarks of Accenture. Agenda Performance

More information

A Thread Monitoring System for Multithreaded Java Programs

A Thread Monitoring System for Multithreaded Java Programs A Thread Monitoring System for Multithreaded Java Programs Sewon Moon and Byeong-Mo Chang Department of Computer Science Sookmyung Women s University, Seoul 140-742, Korea wonsein@nate.com, chang@sookmyung.ac.kr

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Logging in Java Applications

Logging in Java Applications Logging in Java Applications Logging provides a way to capture information about the operation of an application. Once captured, the information can be used for many purposes, but it is particularly useful

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Replication on Virtual Machines

Replication on Virtual Machines Replication on Virtual Machines Siggi Cherem CS 717 November 23rd, 2004 Outline 1 Introduction The Java Virtual Machine 2 Napper, Alvisi, Vin - DSN 2003 Introduction JVM as state machine Addressing non-determinism

More information

Garbage Collection in the Java HotSpot Virtual Machine

Garbage Collection in the Java HotSpot Virtual Machine http://www.devx.com Printed from http://www.devx.com/java/article/21977/1954 Garbage Collection in the Java HotSpot Virtual Machine Gain a better understanding of how garbage collection in the Java HotSpot

More information

CSE 403. Performance Profiling Marty Stepp

CSE 403. Performance Profiling Marty Stepp CSE 403 Performance Profiling Marty Stepp 1 How can we optimize it? public static String makestring() { String str = ""; for (int n = 0; n < REPS; n++) { str += "more"; } return str; } 2 How can we optimize

More information

Java in Virtual Machines on VMware ESX: Best Practices

Java in Virtual Machines on VMware ESX: Best Practices Java in Virtual Machines on VMware ESX: Best Practices TABLE OF CONTENTS 1. SUMMARY OF BEST PRACTICES...1 1.1 Java in Virtual Machines on ESX...1 1.2. Running Applications in ESX Virtual Machines...2 2.

More information

CSC 551: Web Programming. Spring 2004

CSC 551: Web Programming. Spring 2004 CSC 551: Web Programming Spring 2004 Java Overview Design goals & features platform independence, portable, secure, simple, object-oriented, Programming models applications vs. applets vs. servlets intro

More information

Identifying Performance Bottleneck using JRockit. - Shivaram Thirunavukkarasu Performance Engineer Wipro Technologies

Identifying Performance Bottleneck using JRockit. - Shivaram Thirunavukkarasu Performance Engineer Wipro Technologies Identifying Performance Bottleneck using JRockit - Shivaram Thirunavukkarasu Performance Engineer Wipro Technologies Table of Contents About JRockit Mission Control... 3 Five things to look for in JRMC

More information

Restraining Execution Environments

Restraining Execution Environments Restraining Execution Environments Segurança em Sistemas Informáticos André Gonçalves Contents Overview Java Virtual Machine: Overview The Basic Parts Security Sandbox Mechanisms Sandbox Memory Native

More information

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1 The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

The Java Virtual Machine (JVM) Pat Morin COMP 3002

The Java Virtual Machine (JVM) Pat Morin COMP 3002 The Java Virtual Machine (JVM) Pat Morin COMP 3002 Outline Topic 1 Topic 2 Subtopic 2.1 Subtopic 2.2 Topic 3 2 What is the JVM? The JVM is a specification of a computing machine Instruction set Primitive

More information