Work Analysis with Resource-Aware Session Types

Size: px
Start display at page:

Download "Work Analysis with Resource-Aware Session Types"

Transcription

1 Work Analysis with Resource-Aware Session Types Ankush Das Jan Hoffmann Frank Pfenning LICS, July 10,

2 Goal for this Talk Resource Analysis for Concurrent Programs Execution Time Memory Usage 2

3 Why Resource Analysis? 3

4 Why Resource Analysis? Complexity of Parallel Algorithms Çiçek et. al. (ESOP 15) 3

5 Why Resource Analysis? Complexity of Parallel Algorithms Design of Optimal Scheduling Policies Çiçek et. al. (ESOP 15) Acar et. al. (JFP 16) 3

6 Why Resource Analysis? Complexity of Parallel Algorithms Design of Optimal Scheduling Policies Çiçek et. al. (ESOP 15) Acar et. al. (JFP 16) Prevention of Side-Channel Attacks Ngo et. al. (S&P 17) 3

7 Why Resource Analysis? Complexity of Parallel Algorithms Design of Optimal Scheduling Policies Çiçek et. al. (ESOP 15) Acar et. al. (JFP 16) Prevention of Static and Side-Channel Attacks Dynamic Profiling Ngo et. al. (S&P 17) Haemmerlé et. al. (FLOPS 17) 3

8 Measures of Execution Time 4

9 Measures of Execution Time Work Sequential Complexity Execution time on one processor 4

10 Measures of Execution Time Work Sequential Complexity Execution time on one processor Span Parallel Complexity Execution time on arbitrarily many processors 4

11 Measures of Execution Time Today s talk! Work Sequential Complexity Execution time on one processor Span Parallel Complexity Execution time on arbitrarily many processors 4

12 Measures of Execution Time Today s talk! ICFP 2018 Work Sequential Complexity Execution time on one processor Span Parallel Complexity Execution time on arbitrarily many processors 4

13 Concurrent Programs are hard to analyze! 5

14 Concurrent Programs are hard to analyze! Shared Memory Read/Write Overhead 5

15 Concurrent Programs are hard to analyze! Shared Memory Communication Overhead Read/Write Overhead 5

16 Concurrent Programs are hard to analyze! Shared Memory Communication Overhead Read/Write Overhead Deadlocks 5

17 Concurrent Programs are hard to analyze! Shared Memory Communication Overhead Read/Write Overhead Deadlocks Non-Compositional 5

18 Session types can help :-) Shared Memory Communication Overhead Read/Write Overhead Deadlocks Non-Compositional 5

19 Session types can help :-) No Shared Memory Communication Overhead Deadlocks Non-Compositional 5

20 Session types can help :-) No Shared Memory Types strictly enforce communication protocols Deadlocks Non-Compositional 5

21 Session types can help :-) No Shared Memory Types strictly enforce communication protocols Deadlock Freedom Non-Compositional 5

22 Session types can help :-) No Shared Memory Types strictly enforce communication protocols Deadlock Freedom Channels abstract over 5 connected processes

23 What are Session Types? Implement message-passing concurrent programs Communication via bi-directional typed channels Curry-Howard isomorphism with intuitionistic linear logic 6

24 What are Session Types? Implement message-passing concurrent programs Communication via bi-directional typed channels Curry-Howard isomorphism with intuitionistic linear logic P Channel Q Provider Process 6 Client Process

25 What are Session Types? Implement message-passing concurrent programs Communication via bi-directional typed channels Curry-Howard isomorphism with intuitionistic linear logic bits = {b0 : bits, b1 : bits} P c : bits Channel Q Provider Process 6 Client Process

26 What are Session Types? Implement message-passing concurrent programs Communication via bi-directional typed channels Curry-Howard isomorphism with intuitionistic linear logic P bits = {b0 : bits, b1 : bits} b0/b1 c : bits Channel Q Provider Process 6 Client Process

27 Contributions 7

28 Contributions Design a type system to analyze work of session-typed programs 7

29 Contributions Design a type system to analyze work of session-typed programs based on amortized analysis can be parameterized to count different resources proved sound w.r.t. cost semantics conservative extension to standard session type system applied to all standard programs 7

30 Contributions Design a type system to analyze work of session-typed programs based on amortized analysis can be parameterized to count different resources messages exchanged proved sound w.r.t. cost semantics conservative extension to standard session type system applied to all standard programs 7

31 Contributions Design a type system to analyze work of session-typed programs based on amortized analysis can be parameterized to count different resources proved sound w.r.t. cost semantics conservative extension to standard session type system messages exchanged processes spawned applied to all standard programs 7

32 Contributions Design a type system to analyze work of session-typed programs based on amortized analysis can be parameterized to count different resources proved sound w.r.t. cost semantics conservative extension to standard session type system applied to all standard programs 7 messages exchanged processes spawned instructions executed

33 Contributions Design a type system to analyze work of session-typed programs based on amortized analysis can be parameterized to count different resources proved sound w.r.t. cost semantics conservative extension to standard session type system applied to all standard programs 7 messages exchanged processes spawned instructions executed

34 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 8

35 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 8

36 Example: Queues a b c d queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

37 Example: Queues a b c d offers choice of ins/del queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

38 Example: Queues a b c d offers choice of ins/del recv element of type A queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

39 Example: Queues a b c d ins(e) offers choice of ins/del recv element of type A queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

40 Example: Queues a b c d e ins(e) offers choice of ins/del recv element of type A queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

41 Example: Queues a b c d e ins(e) offers choice of ins/del recv element of type A behave as queue again queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

42 Example: Queues a b c d e offers choice of ins/del del queue A =&{ins : A ( queue A, del : {none : 1, some : A queue A }} 9

43 Example: Queues a b c d e offers choice of ins/del del queue A =&{ins : A ( queue A, del : {none : 1, send none if queue is empty some : A queue A }} 9

44 Example: Queues a b c d e offers choice of ins/del del queue A =&{ins : A ( queue A, del : {none : 1, terminate send none if queue is empty some : A queue A }} 9

45 Example: Queues a b c d e offers choice of ins/del del queue A =&{ins : A ( queue A, del : {none : 1, send some otherwise some : A queue A }} 9

46 Example: Queues a b c d e del offers choice of ins/del send element of type A queue A =&{ins : A ( queue A, del : {none : 1, send some otherwise some : A queue A }} 9

47 Example: Queues some(a) b c d e offers choice of ins/del send element of type A queue A =&{ins : A ( queue A, del : {none : 1, send some otherwise some : A queue A }} 9

48 Example: Queues some(a) b c d e offers choice of ins/del send element of type A behave as queue again queue A =&{ins : A ( queue A, del : {none : 1, send some otherwise some : A queue A }} 9

49 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz 10

50 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz recv ins and y 10

51 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz recv ins and y send ins and y 10

52 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz recv ins and y send ins and y recurse 10

53 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz recv ins and y send ins and y recurse send some, x 10

54 Session-typed Program x : A (element stored) elemy t : queue A tail of queue elemx s : queue A head of queue elemz recv ins and y send ins and y recurse send some, x 10 terminate

55 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 11

56 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 11

57 Cost Semantics proc(c, w, P) Process P offering along channel c and has performed work w Standard semantics extended with local work counters w for each process Total work of system is sum of local counters w w is incremented every time process P performs some work (this talk: whenever message is sent) 12

58 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 13

59 Overview proc(c, w, P) Cost Semantics Soundness Session types Theorem q w `q P :: (c : A) Type System 13

60 Type System Based on Amortized Analysis! Store potential in each process Potential can be transferred via messages Potential is consumed to perform work 14

61 Type System Based on Amortized Analysis! Store potential in each process Potential can be transferred via messages Potential is consumed to perform work `q P :: (c : A) Process P offers along channel c, acts as a client for channels in Ω and storing potential q 14

62 Concurrent Queues Count the messages! a b c d 15

63 Concurrent Queues Count the messages! a b c d ins(e) 15

64 Concurrent Queues Count the messages! ins(e) ins(e) ins(e) ins(e) a b c d e ins(e) 15

65 Concurrent Queues Count the messages! a b c d e del 15

66 Concurrent Queues Count the messages! some(a) b c d e 15

67 Concurrent Queues Count the messages! b c d e wi = Work done to process insertion = 2n (where n is the size of queue) = ins and e travel to end of queue wd = Work done to process deletion = 2 (sends back some and a ) 15

68 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} 16

69 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} Resource-Aware Session Types types augmented with potential information sender pays potential with message receiver gets potential with message 16

70 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} 17

71 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} recv 2(n+1) units 17

72 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} recv 2(n+1) units send 2n units 17

73 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} recv 2(n+1) units send 2n units cost of 2 17

74 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} recv 2(n+1) units send 2n units cost of 2 recv 2 units 17

75 Type for Queues queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} recv 2(n+1) units send 2n units cost of 2 recv 2 units 17 cost of 2

76 Rule: Sending a label c.k ; P q c : {`r` : A`}`2L `q P :: (c : A) Process P offers along channel c, acts as a client for channels in Ω and storing potential q 18

77 Rule: Sending a label c.k ; P q P p c : {`r` : A`}`2L c : A k `q P :: (c : A) Process P offers along channel c, acts as a client for channels in Ω and storing potential q 18

78 Rule: Sending a label c.k ; P q P p c : {`r` : A`}`2L c : A k `q P :: (c : A) Process P offers along channel c, acts as a client for channels in Ω and storing potential q q p + r k + 1 `p P :: (c : A k ) `q c.k :: (c : {`r` : A`}`2L ) 18

79 Features of Type System Flexible: supports counting of different resources (e.g. messages exchanged, processes spawned, etc.) by being parametric in cost model Compositional: types describe individual processes, not just whole programs Precise: potential upper bounds work accurately Conservative: strict extension of type system General: works on most standard examples Automatic: future work 19

80 Examples! 20

81 Binary Counters ctr[n] =&{inc 1 : ctr[n + 1], val 2dlog(n+1)e+2 : bits} Increment: requires one unit of potential uses amortized analysis! Value: requires logarithmic potential precise work bound 21

82 Stacks vs Queues stack A [n] =&{ins 0 : A ( stack A [n + 1], del 2 : {none : 1, some : A stack A [n 1]}} queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} Which one s more efficient? 22

83 Stacks vs Queues stack A [n] =&{ins 0 : A ( stack A [n + 1], del 2 : {none : 1, some : A stack A [n 1]}} queue A [n] =&{ins 2n : A ( queue A [n + 1], del 2 : {none : 1, some : A queue A [n 1]}} Which one s more efficient? 22

84 Contributions Type System for Work Analysis based on amortized analysis types augmented with potential information work is upper bounded by potential Flexible, Compositional, Precise, Conservative, General, Automatic 23

85 Contributions Type System for Work Analysis based on amortized analysis types augmented with potential information work is upper bounded by potential Flexible, Compositional, Precise, Conservative, General, Automatic Soundness Theorem Cost Semantics 23

86 Contributions Type System for Work Analysis based on amortized analysis types augmented with potential information work is upper bounded by potential Flexible, Compositional, Precise, Conservative, General, Automatic Soundness Theorem Cost Semantics Examples stacks, queues, binary counters efficiency comparison list examples: append, map, fold 23

A Rehabilitation of Message-Passing Concurrency

A Rehabilitation of Message-Passing Concurrency A Rehabilitation of Message-Passing Concurrency Frank Pfenning Carnegie Mellon University PWLConf 2018, St. Louis A Paper I Love Types for Dyadic Interaction, Kohei Honda, CONCUR 1993 With some newer developments

More information

Parallel Complexity Analysis with Temporal Session Types

Parallel Complexity Analysis with Temporal Session Types 1 Parallel Complexity Analysis with Temporal Session Types ANKUSH DAS, Carnegie Mellon University, USA JAN HOFFMANN, Carnegie Mellon University, USA FANK PFENNING, Carnegie Mellon University, USA We study

More information

Parallel Complexity Analysis with Temporal Session Types

Parallel Complexity Analysis with Temporal Session Types Parallel Complexity Analysis with Temporal Session Types ANKUSH DAS, Carnegie Mellon University, USA JAN HOFFMANN, Carnegie Mellon University, USA FANK PFENNING, Carnegie Mellon University, USA We study

More information

Intersections and Unions of Session Types

Intersections and Unions of Session Types Intersections and Unions of Session Types Coşku Acay Frank Pfenning Carnegie Mellon University School of Computer Science ITRS 2016 C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types

More information

Session-Typed Concurrent Contracts HANNAH GOMMERSTADT

Session-Typed Concurrent Contracts HANNAH GOMMERSTADT Session-Typed Concurrent Contracts HANNAH GOMMERSTADT LIMIN JIA & FRANK PFENNING 1 Sorting Process 2 Sorting Process 3 3 Sorting Process 3 5 4 Sorting Process 3 5 4 5 Sorting Process 3 5 4 6 Session Types?!

More information

Lecture Notes on Session Types

Lecture Notes on Session Types Lecture Notes on Session Types 15-814: Types and Programming Languages Frank Pfenning Lecture 22 November 27, 2018 1 Introduction Some of the material in this lecture, specifically, the discussion of external

More information

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53 Modal Logic: Implications for Design of a Language for Distributed Computation Jonathan Moody (with Frank Pfenning) Department of Computer Science Carnegie Mellon University Modal Logic: Implications for

More information

Proofs-Programs correspondance and Security

Proofs-Programs correspondance and Security Proofs-Programs correspondance and Security Jean-Baptiste Joinet Université de Lyon & Centre Cavaillès, École Normale Supérieure, Paris Third Cybersecurity Japanese-French meeting Formal methods session

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Amortized Analysis Thanks to the text authors who contributed to these slides What is amortized analysis? Analyze a sequence of operations

More information

Objects as Session-Typed Processes

Objects as Session-Typed Processes Objects as Session-Typed Processes Stephanie Balzer and Frank Pfenning Computer Science Department, Carnegie Mellon University AGERE! 2015 The essence of object-orientation 2 The essence of object-orientation

More information

On the Logical Foundations of Staged Computation

On the Logical Foundations of Staged Computation On the Logical Foundations of Staged Computation Frank Pfenning PEPM 00, Boston, MA January 22, 2000 1. Introduction 2. Judgments and Propositions 3. Intensional Types 4. Run-Time Code Generation 5. The

More information

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion Today s video will talk about an important concept in computer science which is

More information

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness

More information

Lecture 11 Unbounded Arrays

Lecture 11 Unbounded Arrays Lecture 11 Unbounded Arrays 15-122: Principles of Imperative Computation (Spring 2018) Rob Simmons, Frank Pfenning Arrays have efficient O(1) access to elements given an index, but their size is set at

More information

Verifying Concurrent ML programs

Verifying Concurrent ML programs Verifying Concurrent ML programs a research proposal Gergely Buday Eszterházy Károly University Gyöngyös, Hungary Synchron 2016 Bamberg December 2016 Concurrent ML is a synchronous language a CML program

More information

Runtime Checking for Program Verification Systems

Runtime Checking for Program Verification Systems Runtime Checking for Program Verification Systems Karen Zee, Viktor Kuncak, and Martin Rinard MIT CSAIL Tuesday, March 13, 2007 Workshop on Runtime Verification 1 Background Jahob program verification

More information

CS Lecture 6: Map and Fold. Prof. Clarkson Spring Today s music: Selections from the soundtrack to 2001: A Space Odyssey

CS Lecture 6: Map and Fold. Prof. Clarkson Spring Today s music: Selections from the soundtrack to 2001: A Space Odyssey CS 3110 Lecture 6: Map and Fold Prof. Clarkson Spring 2015 Today s music: Selections from the soundtrack to 2001: A Space Odyssey Review Course so far: Syntax and semantics of (most of) OCaml Today: No

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

Accurate Step Counting

Accurate Step Counting Accurate Step Counting Catherine Hope and Graham Hutton University of Nottingham Abstract Starting with an evaluator for a language, an abstract machine for the same language can be mechanically derived

More information

CS 445: Data Structures Final Examination: Study Guide

CS 445: Data Structures Final Examination: Study Guide CS 445: Data Structures Final Examination: Study Guide Java prerequisites Classes, objects, and references Access modifiers Arguments and parameters Garbage collection Self-test questions: Appendix C Designing

More information

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures Comp 104: Operating Systems Concepts Revision Lectures Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects you want to know about??? 1

More information

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers)

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers) Comp 104:Operating Systems Concepts Revision Lectures (separate questions and answers) Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers)

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers) Comp 204: Computer Systems and Their Implementation Lecture 25a: Revision Lectures (separate questions and answers) 1 Today Here are a sample of questions that could appear in the exam Please LET ME KNOW

More information

Type Soundness and Race Freedom for Mezzo

Type Soundness and Race Freedom for Mezzo Type Soundness and Race Freedom for Mezzo Thibaut Balabonski François Pottier Jonathan Protzenko INRIA FLOPS 2014 1 / 42 Mezzo in a few words Mezzo is a high-level programming language, equipped with:

More information

Gradual Parametricity, Revisited

Gradual Parametricity, Revisited aaachicbvddssmwge39nfov6qu30sf4y2lfuerk6i3etbbys0jtdmtle1lkgqj7nrh8am81sfwtrwvh8d3mo12ozshkpyc7zvkywlsrqwy7s9jbn5hcwm5sljdvvf2ds3tlsyyqqmtzywrlgbkorrtpqkkkbcvbaub4y0g8f1uw8/ecfpwu/vmcv+jhqcrhqjpawuuedfiucmqdecljy61nvfofruusouxdk1a7zll4czxjmqgpig0tw/vtdbwuy4wgxj2hsvpk5eopirkzvl5mkriaeqsjkucxk5efmued7qsqj2tnqguv3tyfes5taodgemvf9o1wrxv1onu9gzn1oezopwph4oyhhucsxygsevbcs21arhqfwseperqfjp9kpeacxdelfoi+tksofitkcws1rhlmnbzt1jr41sagcdse+oaqooav1camaoakweatp4aw8gk/gm/fufixb54yjzwf8gfh5a4h9n/m=

More information

The Mezzo case. Jonathan Protzenko. François Pottier FSFMA'13. Why design a new programming language?

The Mezzo case. Jonathan Protzenko. François Pottier FSFMA'13. Why design a new programming language? Why design a new programming language? The Mezzo case François Pottier francois.pottier@inria.fr Jonathan Protzenko jonathan.protzenko@inria.fr INRIA FSFMA'13 Jonathan Protzenko (INRIA) The Mezzo language

More information

Lecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory

Lecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory 1 Example Programs Initially, A = B = 0 P1 P2 A = 1 B = 1 if (B == 0) if (A == 0) critical section

More information

Two Kinds of Foundations

Two Kinds of Foundations Two Kinds of Foundations Robert Harper Computer Science Department Carnegie Mellon University LFCS 30th Anniversary Celebration Edinburgh University Thanks Thanks to Rod, Robin, and Gordon for setting

More information

Consistency. CS 475, Spring 2018 Concurrent & Distributed Systems

Consistency. CS 475, Spring 2018 Concurrent & Distributed Systems Consistency CS 475, Spring 2018 Concurrent & Distributed Systems Review: 2PC, Timeouts when Coordinator crashes What if the bank doesn t hear back from coordinator? If bank voted no, it s OK to abort If

More information

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Lecture slides by Kevin Wayne. Last updated on Apr 8, :13 AM

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Lecture slides by Kevin Wayne. Last updated on Apr 8, :13 AM DATA STRUCTURES amortized analysis binomial heaps Fibonacci heaps union-find Lecture slides by Kevin Wayne http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on Apr 8, 2013 6:13 AM Data structures

More information

Verifying Program Invariants with Refinement Types

Verifying Program Invariants with Refinement Types Verifying Program Invariants with Refinement Types Rowan Davies and Frank Pfenning Carnegie Mellon University Princeton and Yale Colloquium Talks February, 2001 Acknowledgments: Robert Harper 1 Overview

More information

Lecture Notes on Priority Queues

Lecture Notes on Priority Queues Lecture Notes on Priority Queues 15-122: Principles of Imperative Computation Frank Pfenning Lecture 16 October 18, 2012 1 Introduction In this lecture we will look at priority queues as an abstract type

More information

SECOMP Efficient Formally Secure Compilers to a Tagged Architecture. Cătălin Hrițcu INRIA Paris

SECOMP Efficient Formally Secure Compilers to a Tagged Architecture. Cătălin Hrițcu INRIA Paris SECOMP Efficient Formally Secure Compilers to a Tagged Architecture Cătălin Hrițcu INRIA Paris 1 SECOMP Efficient Formally Secure Compilers to a Tagged Architecture Cătălin Hrițcu INRIA Paris 5 year vision

More information

CS Lecture 6: Map and Fold. Prof. Clarkson Fall Today s music: Selections from the soundtrack to 2001: A Space Odyssey

CS Lecture 6: Map and Fold. Prof. Clarkson Fall Today s music: Selections from the soundtrack to 2001: A Space Odyssey CS 3110 Lecture 6: Map and Fold Prof. Clarkson Fall 2014 Today s music: Selections from the soundtrack to 2001: A Space Odyssey Review Features so far: variables, operators, let expressions, if expressions,

More information

Efficient pebbling for list traversal synopses

Efficient pebbling for list traversal synopses Efficient pebbling for list traversal synopses Yossi Matias Ely Porat Tel Aviv University Bar-Ilan University & Tel Aviv University Abstract 1 Introduction 1.1 Applications Consider a program P running

More information

Adaptive Functional Programming

Adaptive Functional Programming Adaptive Functional Programming Umut A. Acar Guy E. Blelloch Robert Harper May 5, 2006 Abstract We present techniques for incremental computing by introducing adaptive functional programming. As an adaptive

More information

Design and Implementation of Concurrent C0

Design and Implementation of Concurrent C0 Design and Implementation of Concurrent C0 Max Willsey Carnegie Mellon University mwillsey@cmu.edu Rokhini rabhu Carnegie Mellon University rokhini@gmail.com Frank fenning Carnegie Mellon University fp@cmu.edu

More information

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu Department of Computer Science Aalborg University Fall 2007 This Lecture Minimum spanning trees Definitions Kruskal s algorithm Prim s algorithm

More information

Lecture 21: Red-Black Trees

Lecture 21: Red-Black Trees 15-150 Lecture 21: Red-Black Trees Lecture by Dan Licata April 3, 2012 Last time, we talked about the signature for dictionaries: signature ORDERED = sig type t val compare : t * t -> order signature DICT

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012 Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012 1 Digital vs Analog Digital signals are binary; analog

More information

Scaling Optimistic Concurrency Control by Approximately Partitioning the Certifier and Log

Scaling Optimistic Concurrency Control by Approximately Partitioning the Certifier and Log Scaling Optimistic Concurrency Control by Approximately Partitioning the Certifier and Log Philip A. Bernstein Microsoft Research Redmond, WA, USA phil.bernstein@microsoft.com Sudipto Das Microsoft Research

More information

Programming with Math and Logic

Programming with Math and Logic .. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing

More information

Register Machines. Connecting evaluators to low level machine code

Register Machines. Connecting evaluators to low level machine code Register Machines Connecting evaluators to low level machine code 1 Plan Design a central processing unit (CPU) from: wires logic (networks of AND gates, OR gates, etc) registers control sequencer Our

More information

Introduction to OCaml

Introduction to OCaml Fall 2018 Introduction to OCaml Yu Zhang Course web site: http://staff.ustc.edu.cn/~yuzhang/tpl References Learn X in Y Minutes Ocaml Real World OCaml Cornell CS 3110 Spring 2018 Data Structures and Functional

More information

Software Analysis. Asymptotic Performance Analysis

Software Analysis. Asymptotic Performance Analysis Software Analysis Performance Analysis Presenter: Jonathan Aldrich Performance Analysis Software Analysis 1 Asymptotic Performance Analysis How do we compare algorithm performance? Abstract away low-level

More information

Today: Amortized Analysis (examples) Multithreaded Algs.

Today: Amortized Analysis (examples) Multithreaded Algs. Today: Amortized Analysis (examples) Multithreaded Algs. COSC 581, Algorithms March 11, 2014 Many of these slides are adapted from several online sources Reading Assignments Today s class: Chapter 17 (Amortized

More information

PCAP: Performance-Aware Power Capping for the Disk Drive in the Cloud

PCAP: Performance-Aware Power Capping for the Disk Drive in the Cloud PCAP: Performance-Aware Power Capping for the Disk Drive in the Cloud Mohammed G. Khatib & Zvonimir Bandic WDC Research 2/24/16 1 HDD s power impact on its cost 3-yr server & 10-yr infrastructure amortization

More information

Goal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3

Goal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3 Goal of Concurrency Control Concurrency Control Transactions should be executed so that it is as though they executed in some serial order Also called Isolation or Serializability Weaker variants also

More information

DATA STRUCTURE AND ALGORITHM USING PYTHON

DATA STRUCTURE AND ALGORITHM USING PYTHON DATA STRUCTURE AND ALGORITHM USING PYTHON Advanced Data Structure and File Manipulation Peter Lo Linear Structure Queue, Stack, Linked List and Tree 2 Queue A queue is a line of people or things waiting

More information

to automatically generate parallel code for many applications that periodically update shared data structures using commuting operations and/or manipu

to automatically generate parallel code for many applications that periodically update shared data structures using commuting operations and/or manipu Semantic Foundations of Commutativity Analysis Martin C. Rinard y and Pedro C. Diniz z Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 fmartin,pedrog@cs.ucsb.edu

More information

Lecture 16: Recapitulations. Lecture 16: Recapitulations p. 1

Lecture 16: Recapitulations. Lecture 16: Recapitulations p. 1 Lecture 16: Recapitulations Lecture 16: Recapitulations p. 1 Parallel computing and programming in general Parallel computing a form of parallel processing by utilizing multiple computing units concurrently

More information

Lecture 14: Recursive Types

Lecture 14: Recursive Types Lecture 14: Recursive Types Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Programming Languages Pratikakis (CSD) Recursive Types CS546, 2018-2019 1 / 11 Motivation

More information

A Logical Foundation for Session-based Concurrent Computation

A Logical Foundation for Session-based Concurrent Computation A Logical Foundation for Session-based Concurrent Computation Bernardo Toninho [Co-advised by: Luís Caires and Frank Pfenning] Computer Science Department Carnegie Mellon University Universidade Nova de

More information

16 Greedy Algorithms

16 Greedy Algorithms 16 Greedy Algorithms Optimization algorithms typically go through a sequence of steps, with a set of choices at each For many optimization problems, using dynamic programming to determine the best choices

More information

8.1. Optimal Binary Search Trees:

8.1. Optimal Binary Search Trees: DATA STRUCTERS WITH C 10CS35 UNIT 8 : EFFICIENT BINARY SEARCH TREES 8.1. Optimal Binary Search Trees: An optimal binary search tree is a binary search tree for which the nodes are arranged on levels such

More information

Today s Outline. CSE 326: Data Structures Asymptotic Analysis. Analyzing Algorithms. Analyzing Algorithms: Why Bother? Hannah Takes a Break

Today s Outline. CSE 326: Data Structures Asymptotic Analysis. Analyzing Algorithms. Analyzing Algorithms: Why Bother? Hannah Takes a Break Today s Outline CSE 326: Data Structures How s the project going? Finish up stacks, queues, lists, and bears, oh my! Math review and runtime analysis Pretty pictures Asymptotic analysis Hannah Tang and

More information

Induction in Coq. Nate Foster Spring 2018

Induction in Coq. Nate Foster Spring 2018 Induction in Coq Nate Foster Spring 2018 Review Previously in 3110: Functional programming in Coq Logic in Coq Curry-Howard correspondence (proofs are programs) Today: Induction in Coq REVIEW: INDUCTION

More information

CMSC351 - Fall 2014, Homework #2

CMSC351 - Fall 2014, Homework #2 CMSC351 - Fall 2014, Homework #2 Due: October 8th at the start of class Name: Section: Grades depend on neatness and clarity. Write your answers with enough detail about your approach and concepts used,

More information

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48 Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem

More information

CMSC 132: Object-Oriented Programming II. Recursive Algorithms. Department of Computer Science University of Maryland, College Park

CMSC 132: Object-Oriented Programming II. Recursive Algorithms. Department of Computer Science University of Maryland, College Park CMSC 132: Object-Oriented Programming II Recursive Algorithms Department of Computer Science University of Maryland, College Park Recursion Recursion is a strategy for solving problems A procedure that

More information

Implementing caches. Example. Client. N. America. Client System + Caches. Asia. Client. Africa. Client. Client. Client. Client. Client.

Implementing caches. Example. Client. N. America. Client System + Caches. Asia. Client. Africa. Client. Client. Client. Client. Client. N. America Example Implementing caches Doug Woos Asia System + Caches Africa put (k2, g(get(k1)) put (k2, g(get(k1)) What if clients use a sharded key-value store to coordinate their output? Or CPUs use

More information

Adaptive Functional Programming

Adaptive Functional Programming Adaptive Functional Programming Umut A. Acar Guy E. Blelloch Robert Harper 16 January 2002 CMU-CS-01-161 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213-3890 Abstract An adaptive

More information

Basic Data Structures and Heaps

Basic Data Structures and Heaps Basic Data Structures and Heaps David Kauchak Sorting demo (http://math.hws.edu/tmcm/java/xsortlab/) Data structures What is a data structure? Way of storing data that facilitates particular operations.

More information

Abstract Relaxed balancing has become a commonly used concept in the design of concurrent search tree algorithms. The idea of relaxed balancing is to

Abstract Relaxed balancing has become a commonly used concept in the design of concurrent search tree algorithms. The idea of relaxed balancing is to The Performance of Concurrent Red-Black Tree Algorithms Institut fur Informatik Report 5 Sabine Hanke Institut fur Informatik, Universitat Freiburg Am Flughafen 7, 79 Freiburg, Germany Email: hanke@informatik.uni-freiburg.de

More information

Scan and Quicksort. 1 Scan. 1.1 Contraction CSE341T 09/20/2017. Lecture 7

Scan and Quicksort. 1 Scan. 1.1 Contraction CSE341T 09/20/2017. Lecture 7 CSE341T 09/20/2017 Lecture 7 Scan and Quicksort 1 Scan Scan is a very useful primitive for parallel programming. We will use it all the time in this class. First, lets start by thinking about what other

More information

Syllabi of the Comprehensive Examination in Computer Science

Syllabi of the Comprehensive Examination in Computer Science Syllabi of the Comprehensive Examination in Computer Science The material of the comprehensive examination is drawn mostly from the undergraduate curriculum at Kuwait University and is updated to reflect

More information

Lecture 7: Transactional Memory Intro. Topics: introduction to transactional memory, lazy implementation

Lecture 7: Transactional Memory Intro. Topics: introduction to transactional memory, lazy implementation Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, lazy implementation 1 Transactions New paradigm to simplify programming instead of lock-unlock, use transaction begin-end

More information

Graphs. Carlos Moreno uwaterloo.ca EIT

Graphs. Carlos Moreno uwaterloo.ca EIT Carlos Moreno cmoreno @ uwaterloo.ca EIT-4103 http://en.wikipedia.org/wiki/six_degrees_of_kevin_bacon https://ece.uwaterloo.ca/~cmoreno/ece250 Standard reminder to set phones to silent/vibrate mode, please!

More information

Activity 13: Amortized Analysis

Activity 13: Amortized Analysis Activity 3: Amortized Analysis Model : Incrementing a binary counter 5 4 3 2 9 8 7 6 5 4 3 2 2 3 4 5 Model shows a binary counter, stored as an array of bits with the 2 i place stored at index i, undergoing

More information

Concurrent specifications beyond linearizability

Concurrent specifications beyond linearizability Concurrent specifications beyond linearizability Éric Goubault Jérémy Ledent Samuel Mimram École Polytechnique, France OPODIS 2018, Hong Kong December 19, 2018 1 / 14 Objects Processes communicate through

More information

Implementation of Process Networks in Java

Implementation of Process Networks in Java Implementation of Process Networks in Java Richard S, Stevens 1, Marlene Wan, Peggy Laramie, Thomas M. Parks, Edward A. Lee DRAFT: 10 July 1997 Abstract A process network, as described by G. Kahn, is a

More information

Concurrent Objects and Linearizability

Concurrent Objects and Linearizability Chapter 3 Concurrent Objects and Linearizability 3.1 Specifying Objects An object in languages such as Java and C++ is a container for data. Each object provides a set of methods that are the only way

More information

Reminder from last time

Reminder from last time Concurrent systems Lecture 5: Concurrency without shared data, composite operations and transactions, and serialisability DrRobert N. M. Watson 1 Reminder from last time Liveness properties Deadlock (requirements;

More information

Concurrency Control. R &G - Chapter 19

Concurrency Control. R &G - Chapter 19 Concurrency Control R &G - Chapter 19 Smile, it is the key that fits the lock of everybody's heart. Anthony J. D'Angelo, The College Blue Book Review DBMSs support concurrency, crash recovery with: ACID

More information

Lecture Notes on Induction and Recursion

Lecture Notes on Induction and Recursion Lecture Notes on Induction and Recursion 15-317: Constructive Logic Frank Pfenning Lecture 7 September 19, 2017 1 Introduction At this point in the course we have developed a good formal understanding

More information

ACONCURRENT system may be viewed as a collection of

ACONCURRENT system may be viewed as a collection of 252 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 10, NO. 3, MARCH 1999 Constructing a Reliable Test&Set Bit Frank Stomp and Gadi Taubenfeld AbstractÐThe problem of computing with faulty

More information

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction : A Distributed Shared Memory System Based on Multiple Java Virtual Machines X. Chen and V.H. Allan Computer Science Department, Utah State University 1998 : Introduction Built on concurrency supported

More information

More about The Competition

More about The Competition Data Structure I More about The Competition TLE? 10 8 integer operations, or 10 7 floating point operations, in a for loop, run in around one second for a typical desktop PC. Therefore, if n = 20, then

More information

SIC: Provably Timing-Predictable Strictly In-Order Pipelined Processor Core

SIC: Provably Timing-Predictable Strictly In-Order Pipelined Processor Core SIC: Provably Timing-Predictable Strictly In-Order Pipelined Processor Core Sebastian Hahn and Jan Reineke RTSS, Nashville December, 2018 saarland university computer science SIC: Provably Timing-Predictable

More information

A Brief Introduction to Standard ML

A Brief Introduction to Standard ML A Brief Introduction to Standard ML Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität

More information

Lecture 21. Lecture 21: Concurrency & Locking

Lecture 21. Lecture 21: Concurrency & Locking Lecture 21 Lecture 21: Concurrency & Locking Lecture 21 Today s Lecture 1. Concurrency, scheduling & anomalies 2. Locking: 2PL, conflict serializability, deadlock detection 2 Lecture 21 > Section 1 1.

More information

Compositional C++ Page 1 of 17

Compositional C++ Page 1 of 17 Compositional C++ Page 1 of 17 Compositional C++ is a small set of extensions to C++ for parallel programming. OVERVIEW OF C++ With a few exceptions, C++ is a pure extension of ANSI C. Its features: Strong

More information

From synchronous models to distributed, asynchronous architectures

From synchronous models to distributed, asynchronous architectures From synchronous models to distributed, asynchronous architectures Stavros Tripakis Joint work with Claudio Pinello, Cadence Alberto Sangiovanni-Vincentelli, UC Berkeley Albert Benveniste, IRISA (France)

More information

Distributed minimum spanning tree problem

Distributed minimum spanning tree problem Distributed minimum spanning tree problem Juho-Kustaa Kangas 24th November 2012 Abstract Given a connected weighted undirected graph, the minimum spanning tree problem asks for a spanning subtree with

More information

Running Probabilistic. Programs Backwards

Running Probabilistic. Programs Backwards Running Probabilistic Programs Backwards Neil Toronto * Jay McCarthy David Van Horn * * University of Maryland Vassar College ESOP 2015 2015/04/14 Roadmap Probabilistic inference, and why it s hard 1 Roadmap

More information

Reference Sheet for CO142.2 Discrete Mathematics II

Reference Sheet for CO142.2 Discrete Mathematics II Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no

More information

Manifest Safety and Security. Robert Harper Carnegie Mellon University

Manifest Safety and Security. Robert Harper Carnegie Mellon University Manifest Safety and Security Robert Harper Carnegie Mellon University Collaborators This work is, in part, joint with Lujo Bauer, Karl Crary, Peter Lee, Mike Reiter, and Frank Pfenning at Carnegie Mellon.

More information

Concurrency Control in Distributed Systems. ECE 677 University of Arizona

Concurrency Control in Distributed Systems. ECE 677 University of Arizona Concurrency Control in Distributed Systems ECE 677 University of Arizona Agenda What? Why? Main problems Techniques Two-phase locking Time stamping method Optimistic Concurrency Control 2 Why concurrency

More information

Ownership of a queue for practical lock-free scheduling

Ownership of a queue for practical lock-free scheduling Ownership of a queue for practical lock-free scheduling Lincoln Quirk May 4, 2008 Abstract We consider the problem of scheduling tasks in a multiprocessor. Tasks cannot always be scheduled independently

More information

Linearizability of Persistent Memory Objects

Linearizability of Persistent Memory Objects Linearizability of Persistent Memory Objects Michael L. Scott Joint work with Joseph Izraelevitz & Hammurabi Mendes www.cs.rochester.edu/research/synchronization/ Workshop on the Theory of Transactional

More information

CSE 146. Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session

CSE 146. Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session CSE 146 Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session Comparing Algorithms Rough Estimate Ignores Details Or really: independent of details What are some details

More information

Virtual Machine Design

Virtual Machine Design Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview

More information

Shared state model. April 3, / 29

Shared state model. April 3, / 29 Shared state April 3, 2012 1 / 29 the s s limitations of explicit state: cells equivalence of the two s programming in limiting interleavings locks, monitors, transactions comparing the 3 s 2 / 29 Message

More information

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Chapter 3: Processes. Operating System Concepts 8 th Edition, Chapter 3: Processes, Silberschatz, Galvin and Gagne 2009 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Silberschatz, Galvin and Gagne 2009

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/30 Definition

More information

CSE 638: Advanced Algorithms. Lectures 18 & 19 ( Cache-efficient Searching and Sorting )

CSE 638: Advanced Algorithms. Lectures 18 & 19 ( Cache-efficient Searching and Sorting ) CSE 638: Advanced Algorithms Lectures 18 & 19 ( Cache-efficient Searching and Sorting ) Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Spring 2013 Searching ( Static B-Trees ) A Static

More information

Concurrent library abstraction without information hiding

Concurrent library abstraction without information hiding Universidad Politécnica de Madrid Escuela técnica superior de ingenieros informáticos Concurrent library abstraction without information hiding Artem Khyzha Advised by Manuel Carro and Alexey Gotsman Madrid

More information