JS Event Loop, Promises, Async Await etc. Slava Kim

Size: px
Start display at page:

Download "JS Event Loop, Promises, Async Await etc. Slava Kim"

Transcription

1 JS Event Loop, Promises, Async Await etc Slava Kim

2 Synchronous Happens consecutively, one after another

3

4 Asynchronous Happens later at some point in time

5

6 Parallelism vs Concurrency

7 What are those???? Concurrency - multiple tasks are handled Parallelism - doing multiple tasks at the same time

8 Parallelism vs Concurrency TA

9 Parallelism vs Concurrency TA Student

10 Parallelism vs Concurrency TA

11 Parallelism vs Concurrency TA

12 Parallelism vs Concurrency TA

13 Parallelism vs Concurrency TA

14 Parallelism vs Concurrency TA

15 Is TA concurrent or parallel? TA is not parallel - there is only one TA TA is concurrent tho, the TA goes around and is helping 3 students simultaneously, but some students need to wait

16 Parallelism vs Concurrency TA TA

17 Parallelism vs Concurrency TA TA

18 Parallelism vs Concurrency TA TA

19 Parallelism vs Concurrency TA TA

20 Parallelism vs Concurrency TA TA

21 Is TA concurrent or parallel? There are multiple TAs - we can achieve parallelism with concurrency Still handling multiple students at the same time

22 CPU analogy Each TA - one CPU Each student - a separate task Some programming languages allow you to use multiple cores (C++, Java) JavaScript is single threaded, can only use one core, but is still concurrent How?

23 Queue TA

24 Queue TA

25 Queue TA

26 Queue JS click keypressclick click time out

27 Why callbacks?

28 Why callbacks? click

29 Callbacks to handle a result of an operation result

30 Time outs and intervals timeout

31 Event Loop JS click result click timeout Each individual event is handled in some order New events are queued up in the end

32 Somewhere in C++ implementation of JS Engine

33 Event Loops example

34 Event Loops example A C (2 second delay) B

35 Event Loops example

36 Event Loops example A C (virtually no delay) B

37 Event Loops: Good It is a simple model to work with to achieve concurrency No need for locks, or critical sections. Each function is a critical section Good when you have a lot of I/O work (most web servers, UI systems) Examples of I/O: talking to database, handling requests, waiting for user to click

38 Event Loop: bad CPU intensive operations will bring down your browser/server Can be confusing for new users No real way to predict in which order events will happen

39 Promises - motivation

40 Promises - motivation Callback hell!

41 Possible solution with promises Only one additional level of nesting Error handling can be grouped together Only one branch of continuation

42 Possible solution with promises Only one additional level of nesting Error handling can be grouped together Only one branch of continuation

43 Promises - await all

44 Promises - await all

45 Promises - race

46 Promises - availability Available in all modern browsers (rip IE) Available in latest Node.js Works with MongoDB client Might need to wrap other libraries into promises interface with promisify Makes code cleaner and easier to manage, yay! Your interviewers will impressed

47 Async/Await New feature in the latest spec of JavaScript Can await on anything that returns a promise Is not yet available widely without special setup Makes code even nicer

48 Callback hell!

49 Possible solution with promises

50 Solution with Async/Await No extra indentation or nesting at all Code reads synchronous but actually is async Handle errors with try/catch construct just like synchronous code

51 Solution with Async/Await No extra indentation or nesting at all Code reads synchronous but actually is async Handle errors with try/catch construct just like synchronous code

52 Why don t we use it now? To make it work, you need to setup a compiler from newest JS to old JS Every function that makes use of await needs to be marked async Can make code difficult to follow

53 But you still can use it Supported in latest node, latest Chrome and latest Firefox Probably will break on a lot of other places [demo]

NODE.JS MOCK TEST NODE.JS MOCK TEST I

NODE.JS MOCK TEST NODE.JS MOCK TEST I http://www.tutorialspoint.com NODE.JS MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Node.js Framework. You can download these sample mock tests at

More information

Introduction to Coroutines. Roman Elizarov elizarov at JetBrains

Introduction to Coroutines. Roman Elizarov elizarov at JetBrains Introduction to Coroutines Roman Elizarov elizarov at JetBrains Asynchronous programming How do we write code that waits for something most of the time? A toy problem Kotlin 1 fun requesttoken(): Token

More information

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015 Introduction to Concurrent Software Systems CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015 1 Goals Present an overview of concurrency in software systems Review the benefits and challenges

More information

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016 Introduction to Concurrent Software Systems CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016 1 Goals Present an overview of concurrency in software systems Review the benefits and challenges

More information

Asynchronous JS. SWE 432, Fall Web Application Development

Asynchronous JS. SWE 432, Fall Web Application Development Asynchronous JS SWE 432, Fall 2018 Web Application Development Review: Asynchronous Synchronous: Make a function call When function call returns, the work is done Asynchronous: Make a function call Function

More information

Swift 5, ABI Stability and

Swift 5, ABI Stability and Swift 5, ABI Stability and Concurrency @phillfarrugia Important Documents Concurrency Manifesto by Chris Lattner https: /gist.github.com/lattner/ 31ed37682ef1576b16bca1432ea9f782 Kicking off Concurrency

More information

Backend Development. SWE 432, Fall Web Application Development

Backend Development. SWE 432, Fall Web Application Development Backend Development SWE 432, Fall 2018 Web Application Development Review: Async Programming Example 1 second each Go get a candy bar Go get a candy bar Go get a candy bar Go get a candy bar Go get a candy

More information

Fresh Async With Kotlin. Presented at QCon SF, 2017 /Roman JetBrains

Fresh Async With Kotlin. Presented at QCon SF, 2017 /Roman JetBrains Fresh Async With Kotlin Presented at QCon SF, 2017 /Roman Elizarov @ JetBrains Speaker: Roman Elizarov 16+ years experience Previously developed high-perf trading software @ Devexperts Teach concurrent

More information

INF5750. Introduction to JavaScript and Node.js

INF5750. Introduction to JavaScript and Node.js INF5750 Introduction to JavaScript and Node.js Outline Introduction to JavaScript Language basics Introduction to Node.js Tips and tools for working with JS and Node.js What is JavaScript? Built as scripting

More information

JavaScript. The Bad Parts. Patrick Behr

JavaScript. The Bad Parts. Patrick Behr JavaScript The Bad Parts Patrick Behr History Created in 1995 by Netscape Originally called Mocha, then LiveScript, then JavaScript It s not related to Java ECMAScript is the official name Many implementations

More information

Asynchronous I/O: A Case Study in Python

Asynchronous I/O: A Case Study in Python Asynchronous I/O: A Case Study in Python SALEIL BHAT A library for performing await -style asynchronous socket I/O was written in Python. It provides an event loop, as well as a set of asynchronous functions

More information

Composable Concurrency in Perl 6. Jonathan Worthington

Composable Concurrency in Perl 6. Jonathan Worthington Composable Concurrency in Perl 6 Jonathan Worthington A short history of pain I ve spent a lot of time working with C# and.net. There, multi-threaded apps are common, partly because you can t tie up the

More information

Module 6 Node.js and Socket.IO

Module 6 Node.js and Socket.IO Module 6 Node.js and Socket.IO Module 6 Contains 2 components Individual Assignment and Group Assignment Both are due on Wednesday November 15 th Read the WIKI before starting Portions of today s slides

More information

NODE.JS SERVER SIDE JAVASCRIPT. Introduc)on Node.js

NODE.JS SERVER SIDE JAVASCRIPT. Introduc)on Node.js NODE.JS SERVER SIDE JAVASCRIPT Introduc)on Node.js Node.js was created by Ryan Dahl starting in 2009. For more information visit: http://www.nodejs.org 1 What about Node.js? 1. JavaScript used in client-side

More information

Composable Concurrency in Perl 6. Jonathan Worthington

Composable Concurrency in Perl 6. Jonathan Worthington Composable Concurrency in Perl 6 Jonathan Worthington A short history of pain I ve spent a lot of time working with C# and.net. There, multi-threaded apps are common, partly because you can t tie up the

More information

Manoj Kumar- From Call back's hell to using Async Await: Automated testing with JavaScript

Manoj Kumar- From Call back's hell to using Async Await: Automated testing with JavaScript Manoj Kumar- From Call back's hell to using Async Await: Automated testing with JavaScript ManojKumar: Welcome everyone again. We are here to see about a primer on Selenium WebDriver JavaScript and Protractor

More information

Design and Implementation of Modern Programming Languages (Seminar)

Design and Implementation of Modern Programming Languages (Seminar) Design and Implementation of Modern Programming Languages (Seminar) Outline Administrivia Intro Schedule Topics GENERAL INFORMATION Intro Introduce students to the core techniques of scientific work Give

More information

Introduction to Concurrency. Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 4 01/21/2010

Introduction to Concurrency. Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 4 01/21/2010 Introduction to Concurrency Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 4 01/21/2010 University of Colorado, 2010 1 Credit where Credit is Due 2 Some text and images for this

More information

WebRTC: Possible? Don McGregor Research Associate MOVES Institute.

WebRTC: Possible? Don McGregor Research Associate MOVES Institute. WebRTC: Possible? Don McGregor Research Associate MOVES Institute mcgredo@nps.edu The World Classic simulation applications: can we do them in the web browser? Pretty much. I think. 2 1990s Start: Classic

More information

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios Simone Bordet sbordet@intalio.com 1 Agenda What are Comet web applications? Impacts of Comet web applications WebSocket

More information

Asynchronous Programming Demystified

Asynchronous Programming Demystified Asynchronous Programming Demystified http://submain.com/webcasts/asynchronous-programming-demystified/ for the webcast recording, slides and demo code download 1/14/2015 Webcast Housekeeping Audio Connect

More information

ECMAScript 2015 and beyond The Future of JavaScript is Now!

ECMAScript 2015 and beyond The Future of JavaScript is Now! ECMAScript 2015 and beyond The Future of JavaScript is Now! Tom Van Cutsem JS.BE Meetup @tvcutsem Talk Outline Part I: 20 years of JavaScript (or, the long road to ECMAScript 6) Part II: a brief tour of

More information

Web Application Development

Web Application Development Web Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie SERVER SIDE JAVASCRIPT PART 1 Outline 1.

More information

Full Stack boot camp

Full Stack boot camp Name Full Stack boot camp Duration (Hours) JavaScript Programming 56 Git 8 Front End Development Basics 24 Typescript 8 React Basics 40 E2E Testing 8 Build & Setup 8 Advanced JavaScript 48 NodeJS 24 Building

More information

Actors in the Small. Making Actors more Useful. Bill La

Actors in the Small. Making Actors more Useful. Bill La Actors in the Small Making Actors more Useful Bill La Forge laforge49@gmail.com @laforge49 Actors in the Small I. Introduction II. Making Actors Fast III.Making Actors Easier to Program IV. Tutorial I.

More information

Asynchronous Programming in Javascript, Part 2. CSCI 5828: Foundations of Software Engineering Lecture 19 10/25/2016

Asynchronous Programming in Javascript, Part 2. CSCI 5828: Foundations of Software Engineering Lecture 19 10/25/2016 Asynchronous Programming in Javascript, Part 2 CSCI 5828: Foundations of Software Engineering Lecture 19 10/25/2016 1 Goals Discussed asynchronous programming in Javascript in Lecture 18 The gap between

More information

Welcome to CS50 section! This is Week 10 :(

Welcome to CS50 section! This is Week 10 :( Welcome to CS50 section! This is Week 10 :( This is our last section! Final project dates Official proposals: due this Friday at noon Status report: due Monday, Nov 28 at noon Hackathon: Thursday, Dec

More information

Reactive Web Programming

Reactive Web Programming Reactive Web Programming Colin Vidal colin.vidal@inria.fr INRIA Sophia Antipolis Supervisors : Manuel Serrano Gérard Berry December 2, 2015 1 / 14 JavaScript language A mainstream language to write web

More information

Concurrency Analysis of Asynchronous APIs

Concurrency Analysis of Asynchronous APIs Concurrency Analysis of Asynchronous APIs Anirudh Santhiar and Aditya Kanade April 2, 2016 Computer Science and Automation, IISc Introduction Asynchronous Programming Model1 A way to organize programs

More information

CS193X: Web Programming Fundamentals

CS193X: Web Programming Fundamentals CS193X: Web Programming Fundamentals Spring 2017 Victoria Kirst (vrk@stanford.edu) CS193X schedule Today - MongoDB - Servers and MongoDB Friday - Web application architecture - Authentication MongoDB installation

More information

Internet Programming Week 10. Instructor: Paulo Fernandes Applied Computer Science University of Winnipeg

Internet Programming Week 10. Instructor: Paulo Fernandes Applied Computer Science University of Winnipeg Internet Programming Week 10 Instructor: Paulo Fernandes Applied Computer Science University of Winnipeg Web Workers Slides only Threading Ever get a slow script message? Q) How could a script be slow

More information

Threads and Locks, Part 2. CSCI 5828: Foundations of Software Engineering Lecture 08 09/18/2014

Threads and Locks, Part 2. CSCI 5828: Foundations of Software Engineering Lecture 08 09/18/2014 Threads and Locks, Part 2 CSCI 5828: Foundations of Software Engineering Lecture 08 09/18/2014 1 Goals Cover the material presented in Chapter 2 of our concurrency textbook In particular, selected material

More information

Chris Buckett. FOREWORD BY Seth Ladd MANNING 6$03/(&+$37(5

Chris Buckett. FOREWORD BY Seth Ladd MANNING 6$03/(&+$37(5 Chris Buckett FOREWORD BY Seth Ladd 6$03/(&+$37(5 MANNING Dart in Action by Chris Buckett Chapter 9 Copyright 2013 Manning Publications brief contents PART 1 INTRODUCING DART...1 1 Hello Dart 3 2 Hello

More information

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8 PROCESSES AND THREADS THREADING MODELS CS124 Operating Systems Winter 2016-2017, Lecture 8 2 Processes and Threads As previously described, processes have one sequential thread of execution Increasingly,

More information

Inside core.async Channels. Rich Hickey

Inside core.async Channels. Rich Hickey Inside core.async s Rich Hickey Warning! Implementation details Subject to change The Problems Single channel implementation For use from both dedicated threads and go threads simultaneously, on same channel

More information

HTML5 Evolution and Development. Matt Spencer UI & Browser Marketing Manager

HTML5 Evolution and Development. Matt Spencer UI & Browser Marketing Manager HTML5 Evolution and Development Matt Spencer UI & Browser Marketing Manager 1 HTML5 Ratified. finally! After 7 years of development, the HTML5 specification was ratified on 28 th October 14 urce>

More information

Parallelism, Concurrency, and Asynchrony in Perl 6. Jonathan Worthington

Parallelism, Concurrency, and Asynchrony in Perl 6. Jonathan Worthington Parallelism, Concurrency, and Asynchrony in Perl 6 Jonathan Worthington Hi! I'm Jonathan. Lead developer of Rakudo Perl 6 Founder and architect of MoarVM Work as a software architect and teacher Live in

More information

Ten interesting features of Google s Angular Project

Ten interesting features of Google s Angular Project Ten interesting features of Google s Angular Project - 1 Ten interesting features of Google s Angular Project Copyright Clipcode Ltd 2018 All rights reserved Ten interesting features of Google s Angular

More information

Web API Lab. The next two deliverables you shall write yourself.

Web API Lab. The next two deliverables you shall write yourself. Web API Lab In this lab, you shall produce four deliverables in folder 07_webAPIs. The first two deliverables should be pretty much done for you in the sample code. 1. A server side Web API (named listusersapi.jsp)

More information

A Sense of Time for JavaScript and Node.js

A Sense of Time for JavaScript and Node.js A Sense of Time for JavaScript and Node.js First-Class Timeouts as a Cure for Event Handler Poisoning James C. Davis Eric R. Williamson Dongyoon Lee COMPUTER SCIENCE - 1 - Contributions Attack: Event Handler

More information

CSCI 201L Written Exam #1 Fall % of course grade

CSCI 201L Written Exam #1 Fall % of course grade Final Score /15 Name SOLUTION ID Extra Credit /0.5 Lecture Section (circle one): TTh 8:00-9:20 TTh 9:30-10:50 TTh 11:00-12:20 CSCI 201L Written Exam #1 Fall 2017 15% of course grade The exam is one hour

More information

What is Node.js? Tim Davis Director, The Turtle Partnership Ltd

What is Node.js? Tim Davis Director, The Turtle Partnership Ltd What is Node.js? Tim Davis Director, The Turtle Partnership Ltd About me Co-founder of The Turtle Partnership Working with Notes and Domino for over 20 years Working with JavaScript technologies and frameworks

More information

High performance reactive applications with Vert.x

High performance reactive applications with Vert.x High performance reactive applications with Vert.x Tim Fox Red Hat Bio Employed By Red Hat to lead the Vert.x project Worked in open source exclusively for the past 9 years Some projects I've been involved

More information

Why I still develop synchronous web in the asyncio era. April 7th, 2017 Giovanni Barillari - pycon otto - Firenze, Italy

Why I still develop synchronous web in the asyncio era. April 7th, 2017 Giovanni Barillari - pycon otto - Firenze, Italy Why I still develop synchronous web in the asyncio era April 7th, 2017 Giovanni Barillari - pycon otto - Firenze, Italy Who am I? I m Gio! pronounced as Joe trust me, I m a physicist :) code principally

More information

Chapter 4: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

JAVA CONCURRENCY FRAMEWORK. Kaushik Kanetkar

JAVA CONCURRENCY FRAMEWORK. Kaushik Kanetkar JAVA CONCURRENCY FRAMEWORK Kaushik Kanetkar Old days One CPU, executing one single program at a time No overlap of work/processes Lots of slack time CPU not completely utilized What is Concurrency Concurrency

More information

Motivation of Threads. Preview. Motivation of Threads. Motivation of Threads. Motivation of Threads. Motivation of Threads 9/12/2018.

Motivation of Threads. Preview. Motivation of Threads. Motivation of Threads. Motivation of Threads. Motivation of Threads 9/12/2018. Preview Motivation of Thread Thread Implementation User s space Kernel s space Inter-Process Communication Race Condition Mutual Exclusion Solutions with Busy Waiting Disabling Interrupt Lock Variable

More information

Chapter 1: Distributed Information Systems

Chapter 1: Distributed Information Systems Chapter 1: Distributed Information Systems Contents - Chapter 1 Design of an information system Layers and tiers Bottom up design Top down design Architecture of an information system One tier Two tier

More information

Reactive Java: Promises and Streams with Reakt. Geoff Chandler and Rick Hightower

Reactive Java: Promises and Streams with Reakt. Geoff Chandler and Rick Hightower Reactive Java: Promises and Streams with Reakt Geoff Chandler and Rick Hightower What is Reakt in 30 seconds! Reakt General purpose library for callback coordination and streams Implements JavaScript

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 7/8: Synchronization (1) Administrivia How is Lab going? Be prepared with questions for this weeks Lab My impression from TAs is that you are on track

More information

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur Control Structures Code can be purely arithmetic assignments At some point we will need some kind of control or decision making process to occur C uses the if keyword as part of it s control structure

More information

Don't Call Us, We'll Call You:

Don't Call Us, We'll Call You: Don't Call Us, We'll Call You: Characterizing Callbacks in JavaScript Keheliya Gallaba, Ali Mesbah, Ivan Beschastnikh University of British Columbia 1 Why JavaScript? On the client 2 Why JavaScript? On

More information

Implementing Mutual Exclusion. Sarah Diesburg Operating Systems CS 3430

Implementing Mutual Exclusion. Sarah Diesburg Operating Systems CS 3430 Implementing Mutual Exclusion Sarah Diesburg Operating Systems CS 3430 From the Previous Lecture The too much milk example shows that writing concurrent programs directly with load and store instructions

More information

Computation at the Speed of Monads July Computation at the Speed of Monads. Brigham Young University - Idaho.

Computation at the Speed of Monads July Computation at the Speed of Monads. Brigham Young University - Idaho. Computation at the Speed of Monads Samuel McAravey Brigham Young University - Idaho mcaravey@live.com 7/14/2014 Abstract Parallelism has been an issue as of late because of the rise of multi-core computers.

More information

AJAX: Asynchronous Event Handling Sunnie Chung

AJAX: Asynchronous Event Handling Sunnie Chung AJAX: Asynchronous Event Handling Sunnie Chung http://adaptivepath.org/ideas/ajax-new-approach-web-applications/ http://stackoverflow.com/questions/598436/does-an-asynchronous-call-always-create-call-a-new-thread

More information

Server-Side JavaScript auf der JVM. Peter Doschkinow Senior Java Architect

Server-Side JavaScript auf der JVM. Peter Doschkinow Senior Java Architect Server-Side JavaScript auf der JVM Peter Doschkinow Senior Java Architect The following is intended to outline our general product direction. It is intended for information purposes only, and may not be

More information

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, January 2018

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, January 2018 News in RSA-RTE 10.2 updated for sprint 2018.03 Mattias Mohlin, January 2018 Overview Now based on Eclipse Oxygen.2 (4.7.2) Contains everything from RSARTE 10.1 and also additional features and bug fixes

More information

Performance Case Study

Performance Case Study Performance Case Study @Fabian_Frank Yahoo! Search, Engineer Youthmedia.eu, Volunteer A Dynamic Website self-contained App self-contained App self-contained App node v0.4.x multi-core

More information

Virtual machines (e.g., VMware)

Virtual machines (e.g., VMware) Case studies : Introduction to operating systems principles Abstraction Management of shared resources Indirection Concurrency Atomicity Protection Naming Security Reliability Scheduling Fairness Performance

More information

ASYNCHRONOUS PROGRAMMING IN C# 5 WITHOUT USE OF MULTIPLE THREADS

ASYNCHRONOUS PROGRAMMING IN C# 5 WITHOUT USE OF MULTIPLE THREADS ASYNCHRONOUS PROGRAMMING IN C# 5 WITHOUT USE OF MULTIPLE THREADS Aleš Keprt Department of Informatics, Moravian College Olomouc ales.keprt@mvso.cz ABSTRACT: Asynchrony is a situation when multiple things

More information

Chapter 4: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

jquery and AJAX

jquery and AJAX jquery and AJAX http://www.flickr.com/photos/pmarkham/3165964414/ Dynamic HTML (DHTML) Manipulating the web page's structure is essential for creating a highly responsive UI Two main approaches Manipulate

More information

Consistency: Relaxed. SWE 622, Spring 2017 Distributed Software Engineering

Consistency: Relaxed. SWE 622, Spring 2017 Distributed Software Engineering Consistency: Relaxed SWE 622, Spring 2017 Distributed Software Engineering Review: HW2 What did we do? Cache->Redis Locks->Lock Server Post-mortem feedback: http://b.socrative.com/ click on student login,

More information

The Various Faces of the.net Task Parallel Library

The Various Faces of the.net Task Parallel Library The Various Faces of the.net Task Parallel Library Luc Bläser Hochschule für Technik Rapperswil Multicore@Siemens 2015 5 Feb 2015, Nuremberg The.NET Task Parallel Library (TPL) State of the art in.net

More information

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012 Eike Ritter 1 Modified: October 16, 2012 Lecture 8: Operating Systems with C/C++ School of Computer Science, University of Birmingham, UK 1 Based on material by Matt Smart and Nick Blundell Outline 1 Concurrent

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Synchronization in Java Department of Computer Science University of Maryland, College Park Multithreading Overview Motivation & background Threads Creating Java

More information

Race Conditions & Synchronization

Race Conditions & Synchronization Race Conditions & Synchronization Lecture 25 Spring 2017 Gries office hours 2 A number of students have asked for time to talk over how to study for the prelim. Gries will hold office hours at the times

More information

Concurrent Programming in C++ Venkat

Concurrent Programming in C++ Venkat Concurrent Programming in C++ Venkat Subramaniam venkats@agiledeveloper.com @venkat_s Platform Neutral The standard concurrency model makes it possible to write portable concurrent code Level of Concurrency

More information

MULTI-THREADED QUERIES

MULTI-THREADED QUERIES 15-721 Project 3 Final Presentation MULTI-THREADED QUERIES Wendong Li (wendongl) Lu Zhang (lzhang3) Rui Wang (ruiw1) Project Objective Intra-operator parallelism Use multiple threads in a single executor

More information

7/6/2015. Motivation & examples Threads, shared memory, & synchronization. Imperative programs

7/6/2015. Motivation & examples Threads, shared memory, & synchronization. Imperative programs Motivation & examples Threads, shared memory, & synchronization How do locks work? Data races (a lower level property) How do data race detectors work? Atomicity (a higher level property) Concurrency exceptions

More information

Introducing Shared-Memory Concurrency

Introducing Shared-Memory Concurrency Race Conditions and Atomic Blocks November 19, 2007 Why use concurrency? Communicating between threads Concurrency in Java/C Concurrency Computation where multiple things happen at the same time is inherently

More information

CIS 3308 Web Application Programming Syllabus

CIS 3308 Web Application Programming Syllabus CIS 3308 Web Application Programming Syllabus (Upper Level CS Elective) Course Description This course explores techniques that are used to design and implement web applications both server side and client

More information

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code.

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code. 20480C: Programming in HTML5 with JavaScript and CSS3 Course Code: 20480C; Duration: 5 days; Instructor-led WHAT YOU WILL LEARN This course provides an introduction to HTML5, CSS3, and JavaScript. This

More information

Introduction to Asynchronous Programming Fall 2014

Introduction to Asynchronous Programming Fall 2014 CS168 Computer Networks Fonseca Introduction to Asynchronous Programming Fall 2014 Contents 1 Introduction 1 2 The Models 1 3 The Motivation 3 4 Event-Driven Programming 4 5 select() to the rescue 5 1

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 15 Branching : IF ELSE Statement We are looking

More information

Cross-compiling C++ to JavaScript. Challenges in porting the join.me common library to HTML5

Cross-compiling C++ to JavaScript. Challenges in porting the join.me common library to HTML5 Cross-compiling C++ to JavaScript Challenges in porting the join.me common library to HTML5 JUNE 24, 2015 LEVENTE HUNYADI join.me at a glance 2 join.me at a glance 3 join.me characteristics Application

More information

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria A Predictable RTOS Mantis Cheng Department of Computer Science University of Victoria Outline I. Analysis of Timeliness Requirements II. Analysis of IO Requirements III. Time in Scheduling IV. IO in Scheduling

More information

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues 4.2 Silberschatz, Galvin

More information

SOFTWARE MAINTENANCE AND EVOLUTION --- REFACTORING FOR ASYNC --- CS563 WEEK 3 - THU

SOFTWARE MAINTENANCE AND EVOLUTION --- REFACTORING FOR ASYNC --- CS563 WEEK 3 - THU SOFTWARE MAINTENANCE AND EVOLUTION --- REFACTORING FOR ASYNC --- CS563 WEEK 3 - THU Danny Dig Course Objectives: Project Practice a research or novel-industrial project through all its stages: - formulate

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Motivation & examples Threads, shared memory, & synchronization

Motivation & examples Threads, shared memory, & synchronization 1 Motivation & examples Threads, shared memory, & synchronization How do locks work? Data races (a lower level property) How do data race detectors work? Atomicity (a higher level property) Concurrency

More information

Server execution of JavaScript: What could possibly go wrong?

Server execution of JavaScript: What could possibly go wrong? Server execution of JavaScript: What could possibly go wrong? Brian Geffon Staff Software Engineer Hello! 2 Outline Introductions Ø Brief History The paradigm shift Problems! Where we are today Closing

More information

55249: Developing with the SharePoint Framework Duration: 05 days

55249: Developing with the SharePoint Framework Duration: 05 days Let s Reach For Excellence! TAN DUC INFORMATION TECHNOLOGY SCHOOL JSC Address: 103 Pasteur, Dist.1, HCMC Tel: 08 38245819; 38239761 Email: traincert@tdt-tanduc.com Website: www.tdt-tanduc.com; www.tanducits.com

More information

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing

More information

DNParallel - Version: 3. TPL Dataflow

DNParallel - Version: 3. TPL Dataflow DNParallel - Version: 3 TPL Dataflow TPL Dataflow DNParallel - Version: 3 4 days Course Description: In this course, you will learn how to use the new.net 4+ features to parallelize existing code, to utilize

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use

More information

Foundations of the C++ Concurrency Memory Model

Foundations of the C++ Concurrency Memory Model Foundations of the C++ Concurrency Memory Model John Mellor-Crummey and Karthik Murthy Department of Computer Science Rice University johnmc@rice.edu COMP 522 27 September 2016 Before C++ Memory Model

More information

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414 Announcements Database Systems CSE 414 Lecture 11: NoSQL & JSON (mostly not in textbook only Ch 11.1) HW5 will be posted on Friday and due on Nov. 14, 11pm [No Web Quiz 5] Today s lecture: NoSQL & JSON

More information

welcome to BOILERCAMP HOW TO WEB DEV

welcome to BOILERCAMP HOW TO WEB DEV welcome to BOILERCAMP HOW TO WEB DEV Introduction / Project Overview The Plan Personal Website/Blog Schedule Introduction / Project Overview HTML / CSS Client-side JavaScript Lunch Node.js / Express.js

More information

Programming in the Life Sciences

Programming in the Life Sciences Programming in the Life Sciences In the Maastricht Science Programme Open PHACTS Community Workshop London, 26 June 2014 1 Who am I? Teacher at Dept. Bioinformatics BiGCaT, NUTRIM, FHML, UM. http://chem-bla-ics.blogspot.com/

More information

Threads Questions Important Questions

Threads Questions Important Questions Threads Questions Important Questions https://dzone.com/articles/threads-top-80-interview https://www.journaldev.com/1162/java-multithreading-concurrency-interviewquestions-answers https://www.javatpoint.com/java-multithreading-interview-questions

More information

Tools. SWE 432, Fall Design and Implementation of Software for the Web

Tools. SWE 432, Fall Design and Implementation of Software for the Web Tools SWE 432, Fall 2016 Design and Implementation of Software for the Web Today Before we can really make anything, there s a bunch of technical stuff to get out of the way Tools make our lives so much

More information

Simplifying Asynchronous Code with

Simplifying Asynchronous Code with Simplifying Asynchronous Code with Scala Async PHILIPP HALLER The Problem Asynchronous code Using an API that requires you to register callbacks? Then you re writing asynchronous code! Problem: callbacks

More information

Mobile App:IT. Methods & Classes

Mobile App:IT. Methods & Classes Mobile App:IT Methods & Classes WHAT IS A METHOD? - A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. -

More information

Asynchronous Programming - Done right

Asynchronous Programming - Done right Asynchronous Programming - Done right ZWEI14. ZWEI14 - A DIGITAL AGENCY WITH CREATIVE DNA. Idea, concept, design, technology and engage in perfectly together. We are young but experienced, creative but

More information

JavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology

JavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology JavaScript: the language of browser interactions Claudia Hauff TI1506: Web and Database Technology ti1506-ewi@tudelft.nl Densest Web lecture of this course. Coding takes time. Be friendly with Codecademy

More information

University of Karlsruhe (TH)

University of Karlsruhe (TH) University of Karlsruhe (TH) Research University founded 1825 Technical Briefing Session Multicore Software Engineering @ ICSE 2009 Transactional Memory versus Locks - A Comparative Case Study Victor Pankratius

More information

CS 3 Introduction to Software Engineering. 3: Exceptions

CS 3 Introduction to Software Engineering. 3: Exceptions CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction

More information

Chapter 4: Multithreaded Programming

Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Silberschatz, Galvin and Gagne 2013 Chapter 4: Multithreaded Programming Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading

More information

Spectre, Meltdown, and the Impact of Security Vulnerabilities on your IT Environment. Orin Jeff Melnick

Spectre, Meltdown, and the Impact of Security Vulnerabilities on your IT Environment. Orin Jeff Melnick Spectre, Meltdown, and the Impact of Security Vulnerabilities on your IT Environment Orin Thomas @orinthomas Jeff Melnick Jeff.Melnick@Netwrix.com In this session Vulnerability types Spectre Meltdown Spectre

More information