Parallel Programming in Contemporary Programming Languages (Part 2)

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

By: Craig Hecock.  A JavaScript runtime environment running Google Chrome’s V8 engine ◦ a.k.a. a server-side solution for JS ◦ Compiles JS, making it.
N ODE.J S S ERVER S IDE J AVASCRIPT Diana Roiswati ( ) Ahmad Syafii ( ) Asri Taraqiadiyu ( )
Go Language * Go - Routines * Channels. New Concepts Do not communicate by sharing memory; instead, share memory by communicating. creating shared memory.
Microprocessors General Features To be Examined For Each Chip Jan 24 th, 2002.
1 Chapter 5 Threads 2 Contents  Overview  Benefits  User and Kernel Threads  Multithreading Models  Solaris 2 Threads  Java Threads.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
3.5 Interprocess Communication
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
 A JavaScript runtime environment running Google Chrome’s V8 engine ◦ a.k.a. a server-side solution for JS ◦ Compiles JS, making it really fast  Runs.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Node.js - What is Node.js? -
Computer Programming 12 Mr. Jean March 19 th, 2013.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Processor Architecture
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Node.Js 1. 2 Contents About Node.Js Web requirement latest trends Introduction Simple web server creation in Node.Js Dynamic Web pages Dynamic web page.
R Some of these slides are from Prof Frank Lin SJSU. r Minor modifications are made. 1.
Lesson 2: First Java Programs. 2.1 Why Java? Java is one of the most popular programming languages in the world. Java is a modern object-oriented programming.
CIS 234: Object-Oriented Programming with Java
Chapter Goals Describe the application development process and the role of methodologies, models, and tools Compare and contrast programming language generations.
Programming in Go(lang)
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Introduction to threads
Applications Active Web Documents Active Web Documents.
Parallel Programming in Contemporary Programming Languages
Object Oriented Programming in
TensorFlow– A system for large-scale machine learning
Introduction to Operating Systems
Chapter 4: Threads.
Node.Js Server Side Javascript
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Introduction to Web Assembly
ITCS-3190.
Processes and Threads Processes and their scheduling
Spark Presentation.
Text by: Lambert and Osborne
Chapter 4: Multithreaded Programming
3 Things Everyone Knows About Node JS That You Don't
JAVA Introduction ការណែនាំពី Java
BTEC NCF Dip in Comp - Unit 15 Website Development Lesson 05 – Website Performance Mr C Johnston.
Lecture 1 Runtime environments.
Introduction Enosis Learning.
Programming Concepts and Languages
Web App vs Mobile App.
Operating System Concepts
Node.Js Server Side Javascript
Introduction Enosis Learning.
Introduction to Operating Systems
Chapter 4: Threads.
Chapter 4: Threads.
Programming Languages
JavaScript.
Java for IOI.
What time is it?. What time is it? Major Concepts: a data structure model: basic representation of data, such as integers, logic values, and characters.
Multithreaded Programming
(Computer fundamental Lab)
Chapter 4: Threads.
Java History, Editions, Version Features
JavaScript CS 4640 Programming Languages for Web Applications
Lecture 1 Runtime environments.
Chapter 4: Threads.
Reasons To Study Programming Languages
Running C# in the browser
Just In Time Compilation
Presentation transcript:

Parallel Programming in Contemporary Programming Languages (Part 2) James Hoekzema

Why Particular Environments leave little choice in the matter (Browsers) Less code, more work Less time learning the ins and outs, more time being productive Don’t reinvent the wheel

What JavaScript - Differences between browsers and the languages they allow Go - Goroutines versus threads: what’s the difference? LabVIEW - What’s under the hood and more on using multicore programming

JavaScript and Alternatives

Why JavaScript is not type checked, but some browsers can boost speed when it is written like it is. Always using callbacks for asynchronous tasks like requests and messaging can stack up. If a browser is setup to use another language, it can be faster due to the strictness of the language.

What Dart - A JS alternative by Google. Object oriented language with particular directives for asynchronous tasks. Can be run in Dartium (Fork of Chrome) and translated to JavaScript for cross-platform use. Also has it’s own VM and can be used to create Android and iOS apps. TypeScript - A JS alternative by Microsoft. Focuses on static type checking and easier object-oriented programming. Can be run in Internet Explorer / Edge (Sort of). Strong emphasis on scalability. Web Assembly - A new standard met to run beside JavaScript for significant speed improvements in areas that need it (heavy processing tasks such as image processing, etc.). Significant advantages: can program for it in “any” language (C/C++ currently supported) and can be run as it is streamed.

What - Web Workers Workers are OS level threads that run in a light JavaScript environment (no access to DOM mainly) Data passed between the page and the worker is deep copied, except for buffers. Buffers are a special data type in JS that represent byte arrays that can be interpreted as sized integers (signed and unsigned), or floats. Access to a buffer is only granted to the controlling thread, meaning a worker has to give back control to the page for the page to use the altered data.

What are Web Workers Good For? Working. Offloading processes such as data crunching, data storage, etc. Safe Environment. Any script can be loaded into a worker, including scripts from other websites. This allows advanced number crunching scripts to be imported without risking an unsafe DOM for your website. Parallelization. You can spin up multiple workers and send them different data to work on.

Web Worker Measurements

The Future Since JavaScript is interpreted, the interpreter can always be improved to use more parallel algorithms. Web Assembly - a binary standard for the web that allows very fast execution as well as execution while streaming Smart “loop” parallelising (for functional concepts like mapping, filtering, etc.) Better latency hiding (HTTP Requests, Blobbing, etc.) Stream and Execute Stream (JS) Execution Complete Execution Start Server Client Server Client Server Client Client

Go (goroutines vs. threads)

Why Most programs and languages rely on pthreads underneath as well as operating systems. This means that scheduling is outside the control of the program. Goroutines are internally managed and much smaller by default compared to a default thread, meaning many more can be created and managed by Go. This is not that simple!

Where Goroutines Differ Default Size of Thread: 2MB Default Size of Goroutine: 8KB Switching between goroutines occurs when Go thinks it’s best, not the operating system.

Performance Measure Go is MUCH faster than scripted languages (JavaScript, Python, etc.) Go is on par with Java and C++ in certains areas, and slower in others. Go is garbage collected like Java, but since it is a much younger, less invested in language, its collector is nowhere near as sophisticated. This does make it safer than C++ and C though. Benefits over Java: Compiled to machine code, not a VM. Several syntactic sugars. Less memory intensive, especially with arrays/lists. Internal concurrency management.

LabVIEW

The Process First Step: Type Propagation - Choosing correct nodes based off type (different int sizes, int vs. float, etc.), casting types when necessary, etc. Second Step: Convert to DFIR graph. Then transform for optimization and code generation. Third Step: Translated into LLVM (Low Level Virtual Machine)

Parallelism in Action Multicore Programming in LabVIEW

Questions?