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

Size: px
Start display at page:

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

Transcription

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

2 2 aicas Group aicas GmbH founded in 2001 in Karlsruhe Focus: Embedded and Realtime Java Analysis and Debugging Tools for Java Head office: Karlsruhe, Germany aicas inc.: New Haven, Connecticut aicas SARL: Paris, France Distributors worldwide

3 3 Demanding customers use JamaicaVM

4 4 Security Example Boeing 787 Dreamliner JamaicaVM: Secure communication with ground station Certified to DO 178B, Level D

5 5 Safety Example Ground surveillance radar BÜR. JamaicaVM used for target tracking.

6 6 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; void increment() { counter++; }

7 7 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; void increment() { r1 = counter; counter++; r2 = r1 + 1; } counter = r2;

8 8 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; Thread 1 Thread 2 void increment() { r1 = counter; counter++; r2 = r1 + 1; } counter = r2; r1 = counter; r2 = r1 + 1; counter = r2;

9 9 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; Thread 1 Thread 2 void increment() { r1 = counter; counter++; r2 = r1 + 1; } counter = r2; r1 = counter; r2 = r1 + 1; counter = r2; One increment() can get lost!

10 10 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; void increment() { counter++; }

11 11 Typical Problems on a Multicore typical code sequence (C/C++ or Java) int counter; void increment() { counter++; } this code misses synchronization but on a single core, it practically always works! on a multicore, chances for failure explode!

12 12 Synchronization solution: synchronize int counter; synchronized void increment() { counter++; } easy, problem solved. Or? See later.

13 13 Atomic Operations What is the result of int a, b; /* 32 bit, initially 0 */ Thread 1 Thread 2 b = a; a = 1;?

14 14 Atomic Operations What is the result of int a, b; /* 32 bit, initially 0 */ Thread 1 Thread 2 b = a; a = 1;? b == 0 b == 1

15 15 Atomic Operations What is the result of long a, b; /* 64 bit, initially 0 */ Thread 1 Thread 2 b = a; a = 1;?

16 16 Atomic Operations What is the result of long a, b; /* 64 bit, initially 0 */ Thread 1 Thread 2 b = a; a = 1;? b == 0 b == 1 b == b ==

17 17 Typical Problems on a Multicore polling update long counter; [..] do { dosomething(); } while (counter < MAX); counter is incremented by parallel thread on a Multicore, changes to counter may not become visible!

18 18 Typical Problems on a Multicore polling update long counter; [..] do { dosomething(); } while (counter < MAX); counter is incremented by parallel thread on a Multicore, changes to counter may not become visible!

19 19 Solution: volatile? polling update volatile long counter; [..] do { dosomething(); } while (counter < MAX); works for Java does not work for C!

20 20 Solution: volatile? polling update volatile long counter; [..] do { dosomething(); } while (counter < MAX); works for Java does not work for C!

21 21 We must understand the memory model! Memory model specifies what optimisations are permitted by the compiler or underlying hardware C/C++ programs have undefined semantics in case of race conditions Java defines a strict memory model

22 22 Java's memory model ordering operations are synchronized block accessing a volatile variable The presence of an ordering operation determines the visible state in shared memory

23 23 Java's memory model: Enforcing Order all reads are completed before entering synchronized block, or reading a volatile variable read fence all writes are completed before exiting a synchronized block, or writing a volatile var write fence

24 24 Java's memory model: Data Races data races are not forbidden in Java you can use shared memory variables your code has to tolerate optimizations examples collecting debugging / profiling information useful if occasional errors due to data races are tolerable

25 25 Example use of Java's memory model Shared memory communication Ptr p; boolean p_valid; Thread 1 p = new Ptr(); p_valid = true;

26 26 Example use of Java's memory model Shared memory communication Ptr p; boolean p_valid; Thread 1 Thread 2 p = new Ptr(); p_valid = true;

27 27 Example use of Java's memory model Shared memory communication Ptr p; boolean p_valid; Thread 1 Thread 2 p = new Ptr(); p_valid = true; if (p_valid) p.call();

28 28 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; if (p_valid) p.call();

29 29 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: if (p_valid) p.call();

30 30 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: t1 = new Ptr(); t2 = true; p_valid = t2; p = t1; if (p_valid) p.call();

31 31 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: t1 = new Ptr(); t2 = true; p_valid = t2; p = t1; Writes reordered! if (p_valid) p.call();

32 32 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: t1 = new Ptr(); t2 = true; p_valid = t2; p = t1; Writes reordered! if (p_valid) p.call();

33 33 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: if (p_valid) p.call(); t1 = new Ptr(); t3 = p; t2 = true; if (p_valid) p_valid = t2; t3.call(); p = t1; Writes reordered! Reads reordered!

34 34 Example use of Java's memory model Shared memory communication Thread 1 Thread 2 p = new Ptr(); p_valid = true; What may happen: t1 = new Ptr(); t3 = p; t2 = true; p_valid = t2; p = t1; Writes reordered! if (p_valid) p.call(); if (p_valid) t3.call(); Reads reordered!

35 35 Example use of Java's memory model Shared memory communication volatile Ptr p; volatile boolean p_valid; Thread 1 Thread 2 p = new Ptr(); p_valid = true; in Java if (p_valid) p.call();

36 36 Example use of Java's memory model Shared memory communication volatile Ptr p; volatile boolean p_valid; Thread 1 Thread 2 p = new Ptr(); p_valid = true; in Java if (p_valid) p.call();

37 37 Example use of Java's memory model Shared memory communication volatile Ptr p; volatile boolean p_valid; Thread 1 Thread 2 p = new Ptr(); if (p_valid) p_valid = true; p.call(); in Java

38 38 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) p_valid = TRUE; p >f =..;(); in C?

39 39 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) p_valid = TRUE; p >f =..;(); in C? CPU may still reorder memory accesses!

40 40 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) p_valid = TRUE; p >f =..;(); in C? CPU may still reorder memory accesses!

41 41 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) p_valid = TRUE; p >f =..;(); in C? CPU may still reorder memory accesses!

42 42 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) p_valid = TRUE; p >f =..; How to fix it? Add memory fences!

43 43 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) asm volatile( p >f =..; "sfence":::"memory"); p_valid = TRUE; How to fix it? Add memory fences!

44 44 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) asm volatile( { "sfence":::"memory"); asm volatile( p_valid = TRUE; } How to fix it? Add memory fences! "lfence":::"memory"); p >f =..;

45 45 Example use of C's memory model Shared memory communication volatile Obj *p; volatile boolean p_valid; Thread 1 Thread 2 p = malloc(..); if (p_valid) asm volatile( { "sfence":::"memory"); asm volatile( p_valid = TRUE; "lfence":::"memory"); p >f =..; } How to fix it? Add memory fences!

46 46 Out of thin Air imagine this code int x = 0, n = 0; Thread 1 Thread 2 for(i=0;i<n;i++) x = 42; x += f(i); print(x);

47 47 Out of thin Air imagine this code int x = 0, n = 0; Thread 1 Thread 2 for(i=0;i<n;i++) x = 42; x += f(i); print(x); can only print 42 in Java

48 48 Out of thin Air: Introduction of Writes loop optimization in C/C++ int x = 0, n = 0; Thread 1 Thread 2 tmp = x; for(i=0;i<n;i++) x = 42; tmp += f(i); x = tmp; print(x);

49 49 Out of thin Air: Introduction of Writes loop optimization in C/C++ int x = 0, n = 0; Thread 1 Thread 2 tmp = x; for(i=0;i<n;i++) x = 42; tmp += f(i); x = tmp; print(x); can print 0 in C/C++

50 50 Out of thin Air imagine this code int x = 0, y = 0; Thread 1 Thread 2 r1 = x; r2 = y; y = r1; x = r2;

51 51 Out of thin Air imagine this code int x = 0, y = 0; Thread 1 Thread 2 r1 = x; r2 = y; y = r1; x = r2; Expected result x == 0; y == 0; Only possible result in Java

52 52 Out of thin Air: Optimization in C/C++ imagine this code int x = 0, y = 0; Thread 1 Thread 2 y = 42; r2 = y; r1 = x; x = r2; if (r1!= 42) y = r1; Possible in upcoming C++ MM. Results in x == 42; y == 42;

53 53 Performance on a Multicore example: single core app, 3 threads all threads synchronize frequently on the same lock

54 54 Performance on a Multicore example: single core app, 3 threads all threads synchronize frequently on the same lock while (true) { synchronized (lock) { counter++; } dosomething(); }

55 55 Performance on a Multicore example: single core app, 3 threads

56 56 Performance on a Multicore example: single core app, 3 threads on a multicore

57 57 Lock free Algorithms typical code sequence do { x = counter; result = CAS(counter,x,x+1); } while (result!= x);

58 58 Compare And Swap Issues typical code sequence do { x = counter; result = CAS(counter,x,x+1); } while (result!= x); what is the WCET??

59 59 Compare And Swap Issues typical code sequence do { x = counter; result = CAS(counter,x,x+1); } while (result!= x); what is the WCET?? frequency On dual core: # iterations

60 60 Lock free library code use of libraries helps AtomicInteger counter = new AtomicInteger(); void increment() { (void) counter.incrementandget(); } Code is easier and safer Hand made lock free algorithms are not for everyday development

61 61 Compare And Swap Solutions one way state changes, without retry bounded number of retries

62 62 One way state changes using CAS example code: for (i=0; i<n; i++) { new Thread() { public void run() { CAS(state,INIT,STARTING); [..] } }.start(); }

63 63 Bounded # of retries for CAS introduce long enough code sections in between 2 compare and swap loops then, if a retry is required, one other CPU was successful after n 1 conflicts, we can be sure that all other CPUs are outside the CAS loop

64 64 Bounded # of retries for CAS: Example AtomicInteger counter = new AtomicInteger(); static final int GRANULARITY = 64; [..] new Thread(){ int local_counter; public void inccounter() { local_counter++; if (local_counter >= GRANULARITY) { local_counter = 0; counter.addandset(granularity); } } }.start();

65 Measurements # of CAS tries is bounded: 1E+11 1E+10 1E+9 1E+8 1E+7 1E+6 1E+5 1E+4 1E+3 1E E+1 1E+0 1E-1 alloc free sweep available Memory On 8 CPU x86 system (Linux) Multi Core und Echtzeit Böse Überraschungen vermeideen 65

66 66 Conclusion Code that runs well on single CPU suddenly fails on a multicore Clear semantics of concurrent code is required for safe applications Concurrency at a high level is most beneficial

Facing the Challenges for Real-Time Software Development on Multi-Cores

Facing the Challenges for Real-Time Software Development on Multi-Cores Facing the Challenges for Real-Time Software Development on Multi-Cores Dr. Fridtjof Siebert aicas GmbH Haid-und-Neu-Str. 18 76131 Karlsruhe, Germany siebert@aicas.com Abstract Multicore systems introduce

More information

Multicore Systems Challenges for the Real-Time Software Developer

Multicore Systems Challenges for the Real-Time Software Developer Multicore Systems Challenges for the Real-Time Software Developer Dr. Fridtjof Siebert aicas GmbH Haid-und-Neu-Str. 18 76131 Karlsruhe, Germany siebert@aicas.com Abstract Multicore systems have become

More information

Java Environment for Parallel Realtime Development Platform Independent Software Development for Multicore Systems

Java Environment for Parallel Realtime Development Platform Independent Software Development for Multicore Systems Java Environment for Parallel Realtime Development Platform Independent Software Development for Multicore Systems Ingo Prötel, aicas GmbH Computing Frontiers 6 th of May 2008, Ischia, Italy Jeopard-Project:

More information

Java Memory Model: Content

Java Memory Model: Content Java Memory Model: Content Memory Models Double Checked Locking Problem Java Memory Model: Happens Before Relation Volatile: in depth 16 March 2012 1 Java Memory Model JMM specifies guarantees given by

More information

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I)

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I) SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics

More information

Java in sicherheits-kritischen Systemen: Das HIJA-Profil

Java in sicherheits-kritischen Systemen: Das HIJA-Profil Java in sicherheits-kritischen Systemen: Das HIJA-Profil... Korrektheitsnachweis für (echtzeit-) Java Anwendungen Dr. Fridtjof Siebert Director of Development, aicas GmbH Java Forum, Stuttgart, 7. Juli

More information

A Comparison Of Shared Memory Parallel Programming Models. Jace A Mogill David Haglin

A Comparison Of Shared Memory Parallel Programming Models. Jace A Mogill David Haglin A Comparison Of Shared Memory Parallel Programming Models Jace A Mogill David Haglin 1 Parallel Programming Gap Not many innovations... Memory semantics unchanged for over 50 years 2010 Multi-Core x86

More information

Introduction to Embedded Systems. Software Update Problem

Introduction to Embedded Systems. Software Update Problem Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis logistics minor Today s topics: more software development issues 1 CS 5780 Software Update Problem Lab machines work let us know if they don t

More information

Lesson 4: Software for embedding in a System- Part 1 ROM image, Programming Languages and Program models

Lesson 4: Software for embedding in a System- Part 1 ROM image, Programming Languages and Program models Lesson 4: Software for embedding in a System- Part 1 ROM image, Programming Languages and Program models 1 Outline ROM image Programming Languages Program models 2 1. ROM Image Final stage software also

More information

Realtime Java. Christoph Neijenhuis

Realtime Java. Christoph Neijenhuis Realtime Java Christoph Neijenhuis Agenda 2 RT Problems in Java Solutions: RTSJ and others Guiding Principles Memory Management Threads Asynchronous Event Handling Scheduling Time Synchronization Implementations

More information

Lecture 6: Semaphores and Monitors

Lecture 6: Semaphores and Monitors HW 2 Due Tuesday 10/18 Lecture 6: Semaphores and Monitors CSE 120: Principles of Operating Systems Alex C. Snoeren Higher-Level Synchronization We looked at using locks to provide mutual exclusion Locks

More information

CPU performance monitoring using the Time-Stamp Counter register

CPU performance monitoring using the Time-Stamp Counter register CPU performance monitoring using the Time-Stamp Counter register This laboratory work introduces basic information on the Time-Stamp Counter CPU register, which is used for performance monitoring. The

More information

University of Waterloo Midterm Examination

University of Waterloo Midterm Examination University of Waterloo Midterm Examination Spring, 2006 Student Name: Student ID Number: Section: Course Abbreviation and Number Course Title CS350 Operating Systems Sections 01 (14:30), 02 (11:30) Instructor

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.033 Computer Systems Engineering: Spring 2012 Quiz I Solutions There are 13 questions and 9 pages in this

More information

Data races in Java and static analysis

Data races in Java and static analysis Data races in Java and static analysis Frédéric Dabrowski 1 INRIA, LANDE Frédéric Dabrowski (INRIA, LANDE) Static race detection 1 / 33 Outline 1 Concurrency in Java 2 Static Detection of dataraces { Flanagan,

More information

Part III Synchronization Critical Section and Mutual Exclusion

Part III Synchronization Critical Section and Mutual Exclusion Part III Synchronization Critical Section and Mutual Exclusion Fall 2016 The question of whether computers can think is just like the question of whether submarines can swim 1 Edsger W. Dijkstra Process

More information

Cool Tools for SPARC Systems - overview Darryl Gove

Cool Tools for SPARC Systems - overview Darryl Gove Cool Tools for SPARC Systems - overview Darryl Gove Compiler Performance Engineering 2 Outline Throughput Computing Porting Compiling Instrumenting Optimising Debugging Threading Throughput Computing 3

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

Outline. Memory Consistency Models 11/18/2012. Multi-threaded programs on multiprocessor. Multi-threaded programs on simple uniprocessor

Outline. Memory Consistency Models 11/18/2012. Multi-threaded programs on multiprocessor. Multi-threaded programs on simple uniprocessor Outline Memory Consistency Models Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency model Relaxed memory models weak consistency model

More information

Introduction to Java A First Look

Introduction to Java A First Look Introduction to Java A First Look Java is a second or third generation object language Integrates many of best features Smalltalk C++ Like Smalltalk Everything is an object Interpreted or just in time

More information

Parallel Computing. Parallel shared memory computing with OpenMP

Parallel Computing. Parallel shared memory computing with OpenMP Parallel Computing Parallel shared memory computing with OpenMP Thorsten Grahs, 14.07.2014 Table of contents Introduction Directives Scope of data Synchronization OpenMP vs. MPI OpenMP & MPI 14.07.2014

More information

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

More information

Mutual Exclusion using Monitors

Mutual Exclusion using Monitors Mutual Exclusion using Monitors Some programming languages, such as Concurrent Pascal, Modula-2 and Java provide mutual exclusion facilities called monitors. They are similar to modules in languages that

More information

GTask Developing asynchronous applications for multi-core efficiency

GTask Developing asynchronous applications for multi-core efficiency GTask Developing asynchronous applications for multi-core efficiency February 2009 SCALE 7x Los Angeles Christian Hergert What Is It? GTask is a mini framework to help you write asynchronous code. Dependencies

More information

Using the Intel Inspector XE

Using the Intel Inspector XE Using the Dirk Schmidl schmidl@rz.rwth-aachen.de Rechen- und Kommunikationszentrum (RZ) Race Condition Data Race: the typical OpenMP programming error, when: two or more threads access the same memory

More information

Built-in Concurrency Primitives in Java Programming Language. by Yourii Martiak and Mahir Atmis

Built-in Concurrency Primitives in Java Programming Language. by Yourii Martiak and Mahir Atmis Built-in Concurrency Primitives in Java Programming Language by Yourii Martiak and Mahir Atmis Overview One of the many strengths of Java is the built into the programming language support for concurrency

More information

Parallel Computing: Strategies and Implications. Dori Exterman CTO IncrediBuild.

Parallel Computing: Strategies and Implications. Dori Exterman CTO IncrediBuild. Parallel Computing: Strategies and Implications Dori Exterman CTO IncrediBuild. In this session we will discuss Multi-threaded vs. Multi-Process Choosing between Multi-Core or Multi- Threaded development

More information

Monitors (Deprecated)

Monitors (Deprecated) D Monitors (Deprecated) Around the time concurrent programming was becoming a big deal, objectoriented programming was also gaining ground. Not surprisingly, people started to think about ways to merge

More information

Programming Language Seminar Concurrency I-1: Java and C# Memory Models

Programming Language Seminar Concurrency I-1: Java and C# Memory Models Programming Language Seminar Concurrency I-1: Java and C# Memory Models Peter Sestoft Friday 2013-10-25 1 Outline for today, 1 Why parallel programming? Concurrency in Java and C# Problem: shared mutable

More information

Announcements. Classic Sync Problems Monitors. Producer-Consumer Problem. Synchronization Problems. Producer-Consumer Problem

Announcements. Classic Sync Problems Monitors. Producer-Consumer Problem. Synchronization Problems. Producer-Consumer Problem Announcements Classic Sync Problems Monitors Synchronization Problems - Problem Readers-Writers Problem Dining-Philosophers Problem - Problem Unbounded buffer process writes data to buffer Writes to In

More information

Spring 2011 Prof. Hyesoon Kim

Spring 2011 Prof. Hyesoon Kim Spring 2011 Prof. Hyesoon Kim Today, we will study typical patterns of parallel programming This is just one of the ways. Materials are based on a book by Timothy. Decompose Into tasks Original Problem

More information

CONCURRENT PROGRAMMING WITH THREADS R I C K M E R C E R, R I C K S N O D G R A S S, I V A N V A S Q U E Z W I T H H E L P F R O M J O S H B L O C K

CONCURRENT PROGRAMMING WITH THREADS R I C K M E R C E R, R I C K S N O D G R A S S, I V A N V A S Q U E Z W I T H H E L P F R O M J O S H B L O C K CONCURRENT PROGRAMMING WITH THREADS R I C K M E R C E R, R I C K S N O D G R A S S, I V A N V A S Q U E Z W I T H H E L P F R O M J O S H B L O C K OUTLINE Basic concepts Processes Threads Java: Thread

More information

Multi-Threading Performance on Commodity Multi-Core Processors

Multi-Threading Performance on Commodity Multi-Core Processors Multi-Threading Performance on Commodity Multi-Core Processors Jie Chen and William Watson III Scientific Computing Group Jefferson Lab 12000 Jefferson Ave. Newport News, VA 23606 Organization Introduction

More information

Multi-core Programming System Overview

Multi-core Programming System Overview Multi-core Programming System Overview Based on slides from Intel Software College and Multi-Core Programming increasing performance through software multi-threading by Shameem Akhter and Jason Roberts,

More information

Experiences with Pattern-based Software Development

Experiences with Pattern-based Software Development Experiences with Pattern-based Software Development Ralf Jahr University of Augsburg, Germany parmerasa Dissemination Event, Barcelona, 23/09/2014 23/09/2014 Experiences with Pattern-based Software Development

More information

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

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

More information

Intel TSX (Transactional Synchronization Extensions) Mike Dai Wang and Mihai Burcea

Intel TSX (Transactional Synchronization Extensions) Mike Dai Wang and Mihai Burcea Intel TSX (Transactional Synchronization Extensions) Mike Dai Wang and Mihai Burcea 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Example: toy banking application with RTM Code written and tested in

More information

Copyright 2010, Elsevier Inc. All rights Reserved

Copyright 2010, Elsevier Inc. All rights Reserved An Introduction to Parallel Programming Peter Pacheco Chapter 4 Shared Memory Programming with Pthreads 1 Roadmap! Problems programming shared memory systems.! Controlling access to a critical section.!

More information

Real Time Programming: Concepts

Real Time Programming: Concepts Real Time Programming: Concepts Radek Pelánek Plan at first we will study basic concepts related to real time programming then we will have a look at specific programming languages and study how they realize

More information

Intel C++ Parallelism Exploration Compiler, Prototype Edition User s Guide

Intel C++ Parallelism Exploration Compiler, Prototype Edition User s Guide Intel C++ Parallelism Exploration Compiler, Prototype Edition 1. About this Document This document describes language extensions for writing simple parallel programs using the Intel C++ Parallel Exploration

More information

Outline of this lecture G52CON: Concepts of Concurrency

Outline of this lecture G52CON: Concepts of Concurrency Outline of this lecture G52CON: Concepts of Concurrency Lecture 10 Synchronisation in Java Natasha Alechina School of Computer Science nza@cs.nott.ac.uk mutual exclusion in Java condition synchronisation

More information

Antonio Kung, Trialog. HIJA technical coordinator. Scott Hansen, The Open Group. HIJA coordinator

Antonio Kung, Trialog. HIJA technical coordinator. Scott Hansen, The Open Group. HIJA coordinator HIJA Antonio Kung, Trialog HIJA technical coordinator Scott Hansen, The Open Group HIJA coordinator 1 Presentation Outline HIJA project ANRTS platforms Requirements for ANRTS platforms Profiles based on

More information

Understanding Hardware Transactional Memory

Understanding Hardware Transactional Memory Understanding Hardware Transactional Memory Gil Tene, CTO & co-founder, Azul Systems @giltene 2015 Azul Systems, Inc. Agenda Brief introduction What is Hardware Transactional Memory (HTM)? Cache coherence

More information

THE VELOX STACK Patrick Marlier (UniNE)

THE VELOX STACK Patrick Marlier (UniNE) THE VELOX STACK Patrick Marlier (UniNE) 06.09.20101 THE VELOX STACK / OUTLINE 2 APPLICATIONS Real applications QuakeTM Game server C code with OpenMP Globulation 2 Real-Time Strategy Game C++ code using

More information

Thread states. Java threads: synchronization. Thread states (cont.)

Thread states. Java threads: synchronization. Thread states (cont.) Thread states Java threads: synchronization 1. New: created with the new operator (not yet started) 2. Runnable: either running or ready to run 3. Blocked: deactivated to wait for something 4. Dead: has

More information

GPU Hardware Performance. Fall 2015

GPU Hardware Performance. Fall 2015 Fall 2015 Atomic operations performs read-modify-write operations on shared or global memory no interference with other threads for 32-bit and 64-bit integers (c. c. 1.2), float addition (c. c. 2.0) using

More information

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

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

More information

Copyright 2010, Elsevier Inc. All rights Reserved

Copyright 2010, Elsevier Inc. All rights Reserved An Introduction to Parallel Programming Peter Pacheco Chapter 5 Shared Memory Programming with OpenMP 1 Roadmap Writing programs that use OpenMP. Using OpenMP to parallelize many serial for loops with

More information

Lecture 03 Bits, Bytes and Data Types

Lecture 03 Bits, Bytes and Data Types Lecture 03 Bits, Bytes and Data Types In this lecture Computer Languages Assembly Language The compiler Operating system Data and program instructions Bits, Bytes and Data Types ASCII table Data Types

More information

Making Dynamic Memory Allocation Static To Support WCET Analyses

Making Dynamic Memory Allocation Static To Support WCET Analyses Making Dynamic Memory Allocation Static To Support WCET Analyses Jörg Herter Jan Reineke Department of Computer Science Saarland University WCET Workshop, June 2009 Jörg Herter, Jan Reineke Making Dynamic

More information

Threads Scheduling on Linux Operating Systems

Threads Scheduling on Linux Operating Systems Threads Scheduling on Linux Operating Systems Igli Tafa 1, Stavri Thomollari 2, Julian Fejzaj 3 Polytechnic University of Tirana, Faculty of Information Technology 1,2 University of Tirana, Faculty of

More information

We drive Aurix to success Aurix Services for Automotive & Industrial

We drive Aurix to success Aurix Services for Automotive & Industrial Building a safe and secure embedded world We drive Aurix to success Aurix Services for Automotive & Industrial > Services HITEX: An Preferred Design House (PDH) Questions about? Ask us Aurix Services for

More information

More on Session State

More on Session State More on Session State Mostly we have assumed sticky sessions session bound to app server instance Even that is harder than you think: Servlet spec explicitly allows concurrent requests in the same session

More information

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification Introduction Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification Advanced Topics in Software Engineering 1 Concurrent Programs Characterized by

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

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

Race Conditions, Critical Sections and Semaphores

Race Conditions, Critical Sections and Semaphores Race Conditions, Critical Sections and Semaphores In a multiprogrammed system, there are several processes "active" at once. Even a single job can create multiple processes (as in the Lab project using

More information

Atomicity for Concurrent Programs Outsourcing Report. By Khilan Gudka Supervisor: Susan Eisenbach

Atomicity for Concurrent Programs Outsourcing Report. By Khilan Gudka <kg103@doc.ic.ac.uk> Supervisor: Susan Eisenbach Atomicity for Concurrent Programs Outsourcing Report By Khilan Gudka Supervisor: Susan Eisenbach June 23, 2007 2 Contents 1 Introduction 5 1.1 The subtleties of concurrent programming.......................

More information

Oracle Developer Studio Performance Analyzer

Oracle Developer Studio Performance Analyzer Oracle Developer Studio Performance Analyzer The Oracle Developer Studio Performance Analyzer provides unparalleled insight into the behavior of your application, allowing you to identify bottlenecks and

More information

CS 179 Lecture 6. Synchronization, Matrix Transpose, Profiling, AWS Cluster

CS 179 Lecture 6. Synchronization, Matrix Transpose, Profiling, AWS Cluster CS 179 Lecture 6 Synchronization, Matrix Transpose, Profiling, AWS Cluster Synchronization Ideal case for parallelism: no resources shared between threads no communication between threads Many algorithms

More information

OPERATING SYSTEMS. IIIT-Hyderabad

OPERATING SYSTEMS. IIIT-Hyderabad OPERATING SYSTEMS IIIT-Hyderabad OVERVIEW Introduction What is an OS/Kernel? Bootstrap program Interrupts and exceptions Volatile and Non volatile storage!!! Process Management What is a process/system

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Multithreading in Java

Multithreading in Java Multithreading in Java Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park Problem Multiple tasks for computer Draw & display images on screen Check keyboard

More information

Ensuring Code Quality in Multi-threaded Applications

Ensuring Code Quality in Multi-threaded Applications Ensuring Code Quality in Multi-threaded Applications How to Eliminate Concurrency Defects with Static Analysis Ben Chelf, CTO Introduction Most developers would agree that consumers of software today continually

More information

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go Debugging ESE112 Java Programming: API, Psuedo-Code, Scope It is highly unlikely that you will write code that will work on the first go Bugs or errors Syntax Fixable if you learn to read compiler error

More information

Course Development of Programming for General-Purpose Multicore Processors

Course Development of Programming for General-Purpose Multicore Processors Course Development of Programming for General-Purpose Multicore Processors Wei Zhang Department of Electrical and Computer Engineering Virginia Commonwealth University Richmond, VA 23284 wzhang4@vcu.edu

More information

Chapter 8. Statement-Level Control Structures ISBN

Chapter 8. Statement-Level Control Structures ISBN Chapter 8 Statement-Level Control Structures ISBN 0-321-33025-0 Chapter 8 Topics Introduction Selection Statements Iterative Statements Unconditional Branching Guarded Commands Conclusions Copyright 2006

More information

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications Jun Wang, Xi Xiong, Peng Liu Penn State Cyber Security Lab 1 An inherent security limitation

More information

An Easier Way for Cross-Platform Data Acquisition Application Development

An Easier Way for Cross-Platform Data Acquisition Application Development An Easier Way for Cross-Platform Data Acquisition Application Development For industrial automation and measurement system developers, software technology continues making rapid progress. Software engineers

More information

HY345 Operating Systems

HY345 Operating Systems HY345 Operating Systems Recitation 2 - Memory Management Solutions Panagiotis Papadopoulos panpap@csd.uoc.gr Problem 7 Consider the following C program: int X[N]; int step = M; //M is some predefined constant

More information

GPU Profiling with AMD CodeXL

GPU Profiling with AMD CodeXL GPU Profiling with AMD CodeXL Software Profiling Course Hannes Würfel OUTLINE 1. Motivation 2. GPU Recap 3. OpenCL 4. CodeXL Overview 5. CodeXL Internals 6. CodeXL Profiling 7. CodeXL Debugging 8. Sources

More information

Multi-core Curriculum Development at Georgia Tech: Experience and Future Steps

Multi-core Curriculum Development at Georgia Tech: Experience and Future Steps Multi-core Curriculum Development at Georgia Tech: Experience and Future Steps Ada Gavrilovska, Hsien-Hsin-Lee, Karsten Schwan, Sudha Yalamanchili, Matt Wolf CERCS Georgia Institute of Technology Background

More information

Parallel Computing. Shared memory parallel programming with OpenMP

Parallel Computing. Shared memory parallel programming with OpenMP Parallel Computing Shared memory parallel programming with OpenMP Thorsten Grahs, 27.04.2015 Table of contents Introduction Directives Scope of data Synchronization 27.04.2015 Thorsten Grahs Parallel Computing

More information

CS11 Java. Fall 2014-2015 Lecture 7

CS11 Java. Fall 2014-2015 Lecture 7 CS11 Java Fall 2014-2015 Lecture 7 Today s Topics! All about Java Threads! Some Lab 7 tips Java Threading Recap! A program can use multiple threads to do several things at once " A thread can have local

More information

Boxing them in. The Kernel. The Process. The Process. wants to be your friend. Operating System. Buggy apps can crash other apps

Boxing them in. The Kernel. The Process. The Process. wants to be your friend. Operating System. Buggy apps can crash other apps Boxing them in The wants to be your friend App 1 App 2 App 3 Operating System Reading and writing memory, managing resources, accessing I/O would you trust it all to him? Buggy apps can crash other apps

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Resource Utilization of Middleware Components in Embedded Systems

Resource Utilization of Middleware Components in Embedded Systems Resource Utilization of Middleware Components in Embedded Systems 3 Introduction System memory, CPU, and network resources are critical to the operation and performance of any software system. These system

More information

JSR-133: Java TM Memory Model and Thread Specification

JSR-133: Java TM Memory Model and Thread Specification JSR-133: Java TM Memory Model and Thread Specification August 24, 2004, 4:42pm This document is the JSR-133 specification, the Java TM Memory Model and Thread Specification (JMM), as developed by the JSR-133

More information

SEER PROBABILISTIC SCHEDULING FOR COMMODITY HARDWARE TRANSACTIONAL MEMORY. 27 th Symposium on Parallel Architectures and Algorithms

SEER PROBABILISTIC SCHEDULING FOR COMMODITY HARDWARE TRANSACTIONAL MEMORY. 27 th Symposium on Parallel Architectures and Algorithms 27 th Symposium on Parallel Architectures and Algorithms SEER PROBABILISTIC SCHEDULING FOR COMMODITY HARDWARE TRANSACTIONAL MEMORY Nuno Diegues, Paolo Romano and Stoyan Garbatov Seer: Scheduling for Commodity

More information

Optimizing Application Performance with CUDA Profiling Tools

Optimizing Application Performance with CUDA Profiling Tools Optimizing Application Performance with CUDA Profiling Tools Why Profile? Application Code GPU Compute-Intensive Functions Rest of Sequential CPU Code CPU 100 s of cores 10,000 s of threads Great memory

More information

COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms.

COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms. COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms 1 Activation Records activation declaration location Recall that an activation

More information

Bogdan Vesovic Siemens Smart Grid Solutions, Minneapolis, USA bogdan.vesovic@siemens.com

Bogdan Vesovic Siemens Smart Grid Solutions, Minneapolis, USA bogdan.vesovic@siemens.com Evolution of Restructured Power Systems with Regulated Electricity Markets Panel D 2 Evolution of Solution Domains in Implementation of Market Design Bogdan Vesovic Siemens Smart Grid Solutions, Minneapolis,

More information

Memory Management in Java

Memory Management in Java CMSC 433 Programming Language Technologies and Paradigms Spring 2006 Memory Management Memory Management in Java Local variables live on the Allocated at method invocation time Deallocated when method

More information

How to miscompile programs with benign data races

How to miscompile programs with benign data races How to miscompile programs with benign data races Hans-J. Boehm HP Laboratories Abstract Several prior research contributions [15, 9] have explored the problem of distinguishing benign and harmful data

More information

A Lock-free Multithreaded Monte-Carlo Tree Search Algorithm

A Lock-free Multithreaded Monte-Carlo Tree Search Algorithm A Lock-free Multithreaded Monte-Carlo Tree Search Algorithm Markus Enzenberger and Martin Müller Department of Computing Science, University of Alberta Corresponding author: mmueller@cs.ualberta.ca Abstract.

More information

Simple Cooperative Scheduler for Arduino ARM & AVR. Aka «SCoop»

Simple Cooperative Scheduler for Arduino ARM & AVR. Aka «SCoop» Simple Cooperative Scheduler for Arduino ARM & AVR Aka «SCoop» Introduction Yet another library This library aims to provide a light and simple environment for creating powerful multi-threaded programs

More information

AC : TEACHING AN OPERATING SYSTEM COURSE TO CET/EET STUDENTS

AC : TEACHING AN OPERATING SYSTEM COURSE TO CET/EET STUDENTS AC 2009-854: TEACHING AN OPERATING SYSTEM COURSE TO CET/EET STUDENTS Xuefu Zhou, University of Cincinnati American Society for Engineering Education, 2009 Page 14.1124.1 Teaching an Operating System Course

More information

CUDA SKILLS. Yu-Hang Tang. June 23-26, 2015 CSRC, Beijing

CUDA SKILLS. Yu-Hang Tang. June 23-26, 2015 CSRC, Beijing CUDA SKILLS Yu-Hang Tang June 23-26, 2015 CSRC, Beijing day1.pdf at /home/ytang/slides Referece solutions coming soon Online CUDA API documentation http://docs.nvidia.com/cuda/index.html Yu-Hang Tang @

More information

Operating Systems 4 th Class

Operating Systems 4 th Class Operating Systems 4 th Class Lecture 1 Operating Systems Operating systems are essential part of any computer system. Therefore, a course in operating systems is an essential part of any computer science

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

Introduction to GPU hardware and to CUDA

Introduction to GPU hardware and to CUDA Introduction to GPU hardware and to CUDA Philip Blakely Laboratory for Scientific Computing, University of Cambridge Philip Blakely (LSC) GPU introduction 1 / 37 Course outline Introduction to GPU hardware

More information

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney Frysk The Systems Monitoring and Debugging Tool Andrew Cagney Agenda Two Use Cases Motivation Comparison with Existing Free Technologies The Frysk Architecture and GUI Command Line Utilities Current Status

More information

Massachusetts Institute of Technology 6.005: Elements of Software Construction Fall 2011 Quiz 2 November 21, 2011 SOLUTIONS.

Massachusetts Institute of Technology 6.005: Elements of Software Construction Fall 2011 Quiz 2 November 21, 2011 SOLUTIONS. Massachusetts Institute of Technology 6.005: Elements of Software Construction Fall 2011 Quiz 2 November 21, 2011 Name: SOLUTIONS Athena* User Name: Instructions This quiz is 50 minutes long. It contains

More information

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 The Java Virtual Machine and Mobile Devices John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 Objectives Review virtual machine concept Introduce stack machine architecture

More information

Converting Models from Floating Point to Fixed Point for Production Code Generation

Converting Models from Floating Point to Fixed Point for Production Code Generation MATLAB Digest Converting Models from Floating Point to Fixed Point for Production Code Generation By Bill Chou and Tom Erkkinen An essential step in embedded software development, floating- to fixed-point

More information

Parallel Programming

Parallel Programming Parallel Programming 0024 Recitation Week 7 Spring Semester 2010 R 7 :: 1 0024 Spring 2010 Today s program Assignment 6 Review of semaphores Semaphores Semaphoren and (Java) monitors Semaphore implementation

More information

OpenMP. Date: 20/03/2012

OpenMP. Date: 20/03/2012 OpenMP Date: 20/03/2012 1 Introduction OpenMP (Open Multi-Processing) is an API (application programming interface) that supports multi-platform shared memory multiprocessing programming......in C, C++,

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

Monitors, Java, Threads and Processes

Monitors, Java, Threads and Processes Monitors, Java, Threads and Processes 185 An object-oriented view of shared memory A semaphore can be seen as a shared object accessible through two methods: wait and signal. The idea behind the concept

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information