Oolong: an Extensible Concurrent Object Calculus In: Proceedings of SAC 2018: Symposium on Applied Computing (Pp

Total Page:16

File Type:pdf, Size:1020Kb

Oolong: an Extensible Concurrent Object Calculus In: Proceedings of SAC 2018: Symposium on Applied Computing (Pp http://www.diva-portal.org Postprint This is the accepted version of a paper presented at 33rd Annual ACM Symposium on Applied Computing (ACM SAC), Pau, France, April 9–13, 2018.. Citation for the original published paper: Castegren, E., Wrigstad, T. (2018) OOlong: An Extensible Concurrent Object Calculus In: Proceedings of SAC 2018: Symposium on Applied Computing (pp. 1022-1029). 33RD ANNUAL ACM SYMPOSIUM ON APPLIED COMPUTING https://doi.org/10.1145/3167132.3167243 N.B. When citing this work, cite the original published paper. Permanent link to this version: http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-335174 OOlong: An Extensible Concurrent Object Calculus Elias Castegren Tobias Wrigstad [email protected] [email protected] ABSTRACT Ott [20], and all type rules in this paper are generated from this We present OOlong, an object calculus with interface inheritance, definition. To make it easy for other researchers to build on OOlong, structured concurrency and locks. The goal of the calculus is exten- we are making the sources of both versions of the semantics publicly sibility and reuse. The semantics are therefore available in a version available. With the goal of extensibility and re-usability, we make the for LATEX typesetting (written in Ott), and a mechanised version for doing rigorous proofs in Coq. following contributions: KEYWORDS • We define the formal semantics of OOlong, motivate the Object Calculi, Semantics, Mechanisation, Concurrency choice of features, and prove type soundness (§ 2–5). ACM Reference format: • We provide a mechanised version of the full semantics and Elias Castegren and Tobias Wrigstad. 2018. OOlong: An Extensible Con- soundness proof, written in Coq (§ 6). current Object Calculus. In Proceedings of SAC 2018: Symposium on Applied • We provide Ott sources for easily extending the paper version Computing , Pau, France, April 9–13, 2018 (SAC 2018), 8 pages. of the semantics and generating type rules in LATEX (§ 7). https://doi.org/10.1145/3167132.3167243 • We give two examples of how OOlong can be extended; support for assertions, and more fine-grained locking based 1 INTRODUCTION on regions (§ 8). When reasoning about object-oriented programming, object calculi are a useful tool for abstracting away many of the complicated de- tails of a full-blown programming language. They provide a context 2 RELATED WORK for prototyping in which proving soundness or other interesting The main source of inspiration for OOlong is Welterweight Java by properties of a language is doable with reasonable effort. Östlund and Wrigstad [15], a concurrent core calculus for Java with The level of detail depends on which concepts are under study. ease of reuse as an explicit goal. Welterweight Java is also defined One of the most used calculi is Featherweight Java, which models in Ott, which facilitates simple extension and LATEX typesetting, but inheritance but completely abstracts away mutable state [12]. The only exists as a calculus on paper. There is no online resource for lack of state makes it unsuitable for reasoning about any language accessing the Ott sources, and no published proofs except for the feature which entails object mutation, and many later extensions of sketches in the original treatise. OOlong provides Ott sources and the calculus re-adds state as a first step. Other proposals have also is also fully mechanised in Coq, increasing reliability. Having a arisen as contenders for having “just the right level of detail” [3, 15, proof that can be extended along with the semantics also improves 21]. re-usability. Both the Ott sources and the mechanised semantics This paper introduces OOlong, a small, imperative object calculus are publicly available online [5]. OOlong is more lightweight than for the multi-core age. Rather than modelling a specific language, Welterweight Java by omitting mutable variables and using a single OOlong aims to model object-oriented programming in general, flat stack frame instead of modelling the call stack. Also, OOlongis with the goal of being extensible and reusable. To keep subtyping expression-based whereas Welterweight Java is statement-based, simple, OOlong uses interfaces and omits class inheritance and making the OOlong syntax more flexible. We believe that all these method overriding. This avoids tying the language to a specific things make OOlong easier to reason and prove things about, and model of class inheritance (e.g., Java’s), while still maintaining an more suitable for extension than Welterweight Java. object-oriented style of programming. Concurrency is modeled in Object calculi are used regularly as a means of exploring and a finish/async style, and synchronisation is handled via locks. proving properties about language semantics. These calculi are The semantics are provided both on paper and in a mechanised often tailored for some special purpose, e.g., the calculus of de- version written in Coq. The paper version of OOlong is defined in pendent object types [1], which aims to act as a core calculus for Scala, or OrcO [16], which adds objects to the concurrent-by-default Publication rights licensed to ACM. ACM acknowledges that this contribution was language Orc. While these calculi serve their purposes well, their authored or co-authored by an employee, contractor or affiliate of a national govern- ment. As such, the Government retains a nonexclusive, royalty-free right to publish or tailoring also make them fit less well as a basis for extension when reproduce this article, or to allow others to do so, for Government purposes only. reasoning about languages which do not build upon the same fea- SAC 2018, April 9–13, 2018, Pau, France tures. OOlong aims to act as a calculus for common object-oriented © 2018 Copyright held by the owner/author(s). Publication rights licensed to Associa- tion for Computing Machinery. languages in order to facilitate reasoning about extensions for such ACM ISBN 978-1-4503-5191-1/18/04...$15.00 languages. https://doi.org/10.1145/3167132.3167243 SAC 2018, April 9–13, 2018, Pau, France E. Castegren & T. Wrigstad FJ ClJ ConJ MJ LJ WJ OOlong P ::= Ids Cds e (Programs) State × × × × × × Id ::= interface I {Msiдs} (Interfaces) Statements × × × j interface I extends I1; I2 Expressions × × × × × Cd ::= class C implements I {Fds Mds} (Classes) Class Inheritance × × × × × × Msiд ::= m¹x : t1º : t2 (Signatures) Interfaces × × Fd ::= f : t (Fields) Concurrency × × × Md ::= def Msiд {e} (Methods) × × Stack e ::= v j x j x:f j x:f = e (Expressions) Mechanised ×∗ × × j x:m¹eº j let x = e1 in e2 j new C j ¹tº e LATEX sources × × × j finish{async{e1} async{e2}}; e3 j lock¹xº in e j locked {e} Figure 1: A comparison between Featherweight Java, ι ClassicJava, ConcurrentJava, Middleweight Java, Light- v ::= null j ι (Values) weight Java, Welterweight Java and OOlong. The original t ::= C j I j Unit (Types) formulation of Featherweight Java was not mechanised, but Γ ::= ϵ j Γ; x : t j Γ; ι : C (Typing environment) later extensions have been mechanised in Coq [14]. Figure 2: Syntax of OOlong. Ids, Cds, Fds, Mds and Msiдs are sequences of zero or more of their singular counterparts. Terms in grey boxes are not part of the surface syntax but 2.1 Java-based Calculi only appear during evaluation. There are many object calculi which aim to act as a core calculus for Java. While OOlong does not aim to model Java, it does not actively avoid being similar to Java. A Java programmer should feel comfortable looking at OOlong code, but a researcher using OOlong does not need to use Java as the model. Figure 1 surveys the main never mechanised. Strniša proposes Lightweight Java as a simpli- differences between different Java core calculi and OOlong. Incon- fication of Middleweight Java [21], omitting block scoping, type trast to many of the Java-based calculi, OOlong ignores inheritance casts, constructors, expressions, and modelling of the call stack, between classes and instead uses only interfaces. While inheritance while still being a proper subset of Java. Like Welterweight Java it is an important concept in Java, we believe that subtyping is a much is purely based on statements, and does not include interfaces. Like more important concept for object-oriented programming in gen- OOlong, Lightweight Java is defined in Ott, but additionally uses eral. Interfaces provide a simple way to achieve subtyping without Ott to generate a mechanised formalism in Isabelle/HOL. A later having to include concepts like overriding. With interfaces in place, extension of Lightweight Java was also mechanised in Coq (∼800 extending the calculus to model other inheritance techniques like lines generated from Ott, and another ∼5800 lines of proofs) [9]. mixins [11] or traits [19] becomes easier. Last, some language models go beyond the surface language The smallest proposed candidate for a core Java calculus is and execution. One such model is Jinja by Klein and Nipkow [13], probably Featherweight Java [12], which omits all forms of as- which models (parts of) the entire Java architecture, including signment and object state, focusing on a functional core of Java. the virtual machine and compilation from Java to byte code. To While this is enough for reasoning about Java’s type system, the handle the complexity of such a system, Jinja is fully mechanised lack of mutable state precludes reasoning about object-oriented in Isabelle/HOL. The focus of Jinja is different than that of calculi programming in a realistic way. Extensions of this calculus often like OOlong, and is therefore not practical for exploring language re-add state as a first step (e.g., [2, 14, 18]). The original formula- extensions which do not alter the underlying runtime. tion of Featherweight Java was not mechanised, but a later varia- tion omitting casts and introducing assignment was mechanised in Coq (∼2300 lines) [14].
Recommended publications
  • Kotlin Coroutines Deep Dive Into Bytecode #Whoami
    Kotlin Coroutines Deep Dive into Bytecode #whoami ● Kotlin compiler engineer @ JetBrains ● Mostly working on JVM back-end ● Responsible for (almost) all bugs in coroutines code Agenda I will talk about ● State machines ● Continuations ● Suspend and resume I won’t talk about ● Structured concurrency and cancellation ● async vs launch vs withContext ● and other library related stuff Agenda I will talk about Beware, there will be code. A lot of code. ● State machines ● Continuations ● Suspend and resume I won’t talk about ● Structured concurrency and cancellation ● async vs launch vs withContext ● and other library related stuff Why coroutines ● No dependency on a particular implementation of Futures or other such rich library; ● Cover equally the "async/await" use case and "generator blocks"; ● Make it possible to utilize Kotlin coroutines as wrappers for different existing asynchronous APIs (such as Java NIO, different implementations of Futures, etc). via coroutines KEEP Getting Lazy With Kotlin Pythagorean Triples fun printPythagoreanTriples() { for (i in 1 until 100) { for (j in 1 until i) { for (k in i until 100) { if (i * i + j * j < k * k) { break } if (i * i + j * j == k * k) { println("$i^2 + $j^2 == $k^2") } } } } } Pythagorean Triples fun printPythagoreanTriples() { for (i in 1 until 100) { for (j in 1 until i) { for (k in i until 100) { if (i * i + j * j < k * k) { break } if (i * i + j * j == k * k) { println("$i^2 + $j^2 == $k^2") } } } } } Pythagorean Triples fun printPythagoreanTriples() { for (i in 1 until 100) { for (j
    [Show full text]
  • Contention in Structured Concurrency: Provably Efficient Dynamic Non-Zero Indicators for Nested Parallelism
    Contention in Structured Concurrency: Provably Efficient Dynamic Non-Zero Indicators for Nested Parallelism Umut A. Acar1;2 Naama Ben-David 1 Mike Rainey 2 January 16, 2017 CMU-CS-16-133 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 A short version of this work appears in the proceedings of the 22nd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2017 (PPoPP '17). 1Carnegie Mellon University, Pittsburgh, PA 2Inria-Paris Keywords: concurrent data structures, non-blocking data structures, contention, nested parallelism, dependency counters Abstract Over the past two decades, many concurrent data structures have been designed and im- plemented. Nearly all such work analyzes concurrent data structures empirically, omit- ting asymptotic bounds on their efficiency, partly because of the complexity of the analysis needed, and partly because of the difficulty of obtaining relevant asymptotic bounds: when the analysis takes into account important practical factors, such as contention, it is difficult or even impossible to prove desirable bounds. In this paper, we show that considering structured concurrency or relaxed concurrency mod- els can enable establishing strong bounds, also for contention. To this end, we first present a dynamic relaxed counter data structure that indicates the non-zero status of the counter. Our data structure extends a recently proposed data structure, called SNZI, allowing our structure to grow dynamically in response to the increasing degree of concurrency in the system. Using the dynamic SNZI data structure, we then present a concurrent data structure for series-parallel directed acyclic graphs (sp-dags), a key data structure widely used in the implementation of modern parallel programming languages.
    [Show full text]
  • Oolong: a Concurrent Object Calculus for Extensibility and Reuse
    OOlong: A Concurrent Object Calculus for Extensibility and Reuse Elias Castegren Tobias Wrigstad KTH Royal Institute of Technology Uppsala University Kista, Sweden Uppsala, Sweden [email protected] [email protected] ABSTRACT This avoids tying the language to a specific model of class We present OOlong, an object calculus with interface in- inheritance (e.g., Java's), while still maintaining an object- heritance, structured concurrency and locks. The goal of oriented style of programming. Concurrency is modeled in a the calculus is extensibility and reuse. The semantics are finish/async style, and synchronisation is handled via locks. therefore available in a version for LATEX typesetting (written The semantics are provided both on paper and in a mecha- in Ott), a mechanised version for doing rigorous proofs in nised version written in Coq. The paper version of OOlong Coq, and a prototype interpreter (written in OCaml) for is defined in Ott [25], and all typing rules in this paper are typechecking an running OOlong programs. generated from this definition. To make it easy for other researchers to build on OOlong, we are making the sources of both versions of the semantics publicly available. We also CCS Concepts provide a prototype interpreter written in OCaml. •Theory of computation ! Operational semantics; Concur- rency; Interactive proof systems; •Software and its engineer- With the goal of extensibility and re-usability, we make the ing ! Object oriented languages; Concurrent programming following contributions: structures; Interpreters; • We define the formal semantics of OOlong, motivate the choice of features, and prove type soundness (Sections Keywords 2{5). Object Calculi; Semantics; Mechanisation; Concurrency • We provide a mechanised version of the full semantics and soundness proof, written in Coq (Section 6).
    [Show full text]
  • Systematic Use of Models of Concurrency in Executable Domain-Specific Modeling Languages Florent Latombe
    Systematic use of Models of Concurrency in eXecutable Domain-Specific Modeling Languages Florent Latombe To cite this version: Florent Latombe. Systematic use of Models of Concurrency in eXecutable Domain-Specific Modeling Languages. Software Engineering [cs.SE]. Université de Toulouse - Institut National Polytechnique de Toulouse (INPT), 2016. English. tel-01369451 HAL Id: tel-01369451 https://hal.inria.fr/tel-01369451 Submitted on 21 Sep 2016 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. THÈSETHÈSE En vue de l’obtention du DOCTORAT DE L’UNIVERSITÉ DE TOULOUSE Délivré par : l’Institut National Polytechnique de Toulouse (INP Toulouse) Présentée et soutenue le 13/07/2016 par : Florent LATOMBE Systematic use of Models of Concurrency in eXecutable Domain-Specific Modeling Languages JURY Richard PAIGE Professor Rapporteur Antonio VALLECILLO Professor Rapporteur Frédéric BOULANGER Professeur des Universités Examinateur Julien DE ANTONI Maître de Conférences Examinateur Benoît COMBEMALE Maître de Conférences Invité Xavier CRÉGUT Maître de Conférences Encadrant Marc PANTEL Maître de Conférences Encadrant École doctorale et spécialité : MITT : Domaine STIC : Sureté de logiciel et calcul de haute performance Unité de Recherche : IRIT : Institut de Recherche en Informatique de Toulouse (UMR 5505) Directeur(s) de Thèse : Marc PANTEL, Xavier CRÉGUT et Yamine AÏT-AMEUR Rapporteurs : Richard PAIGE et Antonio VALLECILLO All that is gold does not glier, Not all those flho flander are lost; e old that is strong does not flither, Deep roots are not reached by the frost.
    [Show full text]
  • The State of Fibers for the JVM Why All Your JVM Coroutines Are Cool, but Broken, and Project Loom Is Gonna Fix That! Lightweigh
    The State of Fibers for the JVM Lightweight Threads Virtual and ... Why all your JVM coroutines are cool, but broken, (Kilim threads, Quasar fibers, Kotlin coroutines, etc.) and Project Loom is gonna fix that! Volkan Yazıcı https://vlkan.com 2019-12-10 @yazicivo 2018-08-25 2018-03-08 Agenda 1) Motivation 2) History 3) Continuations 4) Processes, threads, and fibers 5) Project Loom 6) Structured concurrency 7) Scoped variables Motivation: I/O Quoting from Gor Nishanov's 2016 "LLVM Coroutines: Bringing resumable functions to LLVM" talk. Without I/O, you don’t exist! ● println() ● file access ● network socket access ● database access ● etc. In 1958, ... Quoting from Gor Nishanov's 2016 "LLVM Coroutines: Bringing resumable functions to LLVM" talk. The legend of Melvin Conway Quoting from Gor Nishanov's 2016 "LLVM Coroutines: Bringing resumable functions to LLVM" talk. Subroutine ⊂ Coroutine Coroutine Subroutine A Subroutine B Subroutine A Coroutine C “Coroutines” – Melvin Conway, 1958 … … B start C start call B “Generalization of subroutine” – Donald Knuth, 1968 call C end suspend subroutines coroutines B start resume C allocate frame, allocate frame, suspend call call B pass params pass params free frame, free frame, return resume C return result return result end end suspend No Yes … resume No Yes … Quoting from Gor Nishanov's 2016 "LLVM Coroutines: Bringing resumable functions to LLVM" talk. Where did all the coroutines go? Algol-60 … introduced code blocks and the begin and end pairs for delimiting them. ALGOL 60 was the first language implementing nested function definitions with lexical scope. – Wikipedia “ALGOL 60” Quoting from Gor Nishanov's 2016 "LLVM Coroutines: Bringing resumable functions to LLVM" talk.
    [Show full text]
  • Revisiting Coroutines
    6 Revisiting Coroutines ANA LUCIA´ DE MOURA and ROBERTO IERUSALIMSCHY Catholic University of Rio de Janeiro (PUC–Rio) This article advocates the revival of coroutines as a convenient general control abstraction. After proposing a new classification of coroutines, we introduce the concept of full asymmetric coroutines and provide a precise definition for it through an operational semantics. We then demonstrate that full coroutines have an expressive power equivalent to one-shot continuations and one-shot delimited continuations. We also show that full asymmetric coroutines and one-shot delimited continuations have many similarities, and therefore present comparable benefits. Nevertheless, coroutines are easier implemented and understood, especially in the realm of procedural languages. Categories and Subject Descriptors: D.3.3 [Programming Languages]: Language Constructs and Features—Control structures, coroutines General Terms: Design, Languages Additional Key Words and Phrases: Continuations, generators, multitasking ACM Reference Format: de Moura, A. L. and Ierusalimschy, R. 2009. Revisiting coroutines. ACM Trans. Program. Lang. Syst. 31, 2, Article 6 (February 2009), 31 pages. DOI = 10.1145/1462166.1462167 http:// doi.acm.org/10.1145/1462166.1462167 1. INTRODUCTION The concept of coroutines was introduced in the early 1960’s and constitutes one of the oldest proposals of a general control abstraction. It is attributed to Conway, who described coroutines as “subroutines who act as the master pro- gram,” and implemented this construct to
    [Show full text]
  • Concurrency Roadmap Misc Interoperability with Objective-C
    Goal: make concurrent programs simpler to reason about and safer (no data races) Data race = two threads access the same data Data races in memory concurrently (at least one writer) Increasing the priority of a task The mechanism to prevent data can automatically increase the Because the child tasks are races proactively priority of the child tasks known Data isolation Actor-local data, and each actor is single- When a higher-priority task waits on threaded (or serial-queued) internally a lower-priority task, the priority of all child tasks can be escalated An actor performs local computation on its own private state This is the timeout problem Nathaniel Smith wrote about in In the form of calling async Examples of systemic Limiting the total time spent on a his blog posts on structured instance methods task management task (including its child tasks) concurrency "by only allowing asynchronous instance problems this can solve Cancelling a task also cancels Actors send messages methods of actor classes to be invoked from "This eliminates the need for any queuing or its child tasks to other actors outside the actor, we ensure that all synchronization within the synchronous Semantics synchronous methods are already inside the code, making such code more efficient and Structured concurrency = concurrent "Task-local storage" can be actor when they are called" simpler to write" programs are organized into tasks and picked up by child tasks child tasks rather than simply a sea of Messages can't be sync It's possible this restriction could be lifted under formally-unrelated threads and jobs Child tasks can communicate up certain circumstances, e.g.
    [Show full text]
  • Java Concurrency Evolution It Is Becoming Crucial to Understand the Tooling Around How the Available Computing Capacity Can Be Best Utilized
    Java Concurrency Evolution It is becoming crucial to understand the tooling around how the available computing capacity can be best utilized. by Csaba Bejan · Dec. 02, 20 · Java Zone · Opinion Since the early days of Java, Threads were available to support concurrent programming. Interestingly till Java 1.1, green threads (virtual threads) were supported by the JVM, but they were dropped in favor of native OS threads, however with Project Loom on the horizon (targeted for Java 16 or later?), virtual threads are on track to become mainstream again. The goal of this article is to go through the main milestones for the evolution of thread/concurrency handling in Java. As the topic can easily fill a library full of books, the following aspects are out of scope (basically, the goal is to take a look at the happy path of Java concurrency): Error handling – This is very limited, to say the least. Lombok’s SneakyThrows is used to support readability in the code examples. Libraries and Frameworks supporting concurrency – There are endless alternative solutions for the JVM (e.g., Quasar, Akka, Guava, EA Async…) Sophisticated stop conditions – When kicking off a thread with a given task, it is not always clear how and how long to wait for its completion Synchronization between threads – The literature is endless about this. So, what will we covering here, you may ask? A very valid question as it may seem that we excluded all the fun stuff. We will take an example task which we will solve multiple times using newer / different approaches, and we will compare their execution ”behavior.” By nature, this list can’t be complete.
    [Show full text]
  • A Runtime Verification Framework for Kotlin Mobile Applications
    A Runtime Verification Framework For Kotlin Mobile Applications Master’s thesis in Computer science and engineering Denis Furian Department of Computer Science and Engineering CHALMERS UNIVERSITY OF TECHNOLOGY UNIVERSITY OF GOTHENBURG Gothenburg, Sweden 2020 Master’s thesis 2020 A Runtime Verification Framework For Kotlin Mobile Applications Denis Furian Department of Computer Science and Engineering Chalmers University of Technology University of Gothenburg Gothenburg, Sweden 2020 A Runtime Verification Framework For Kotlin Mobile Applications Denis Furian © Denis Furian, 2020. Supervisor: Gerardo Schneider, Department of Computer Science and Engineering Industrial Advisor: Boris Tiutin, Opera Software AB External Advisors: Christian Colombo, University of Malta Yliès Falcone, University Grenoble Alps Examiner: Wolfgang Ahrendt, Department of Computer Science and Engineering Master’s Thesis 2020 Department of Computer Science and Engineering Chalmers University of Technology and University of Gothenburg SE-412 96 Gothenburg Telephone +46 31 772 1000 Typeset in LATEX Gothenburg, Sweden 2020 iv A Runtime Verification Framework For Kotlin Mobile Applications Denis Furian Department of Computer Science and Engineering Chalmers University of Technology and University of Gothenburg Abstract The Kotlin programming language has recently been introduced to Android as the recommended language for development. We investigated whether we could use this language to improve the state of the art for Runtime Verification on mobile devices and focused on creating an API to monitor the execution of coroutines, one of the main Kotlin functionalities that are not featured in Java. This API should be employed by Android programmers to carry out concurrent tasks in a monitored environment and verify at runtime that the Kotlin guidelines and best practices for coroutines are being followed.
    [Show full text]
  • Copyright by David Wilson Kitchin 2013
    Copyright by David Wilson Kitchin 2013 The Dissertation Committee for David Wilson Kitchin certifies that this is the approved version of the following dissertation: Orchestration and Atomicity Committee: Jayadev Misra, Supervisor William Cook, Supervisor Don Batory Keshav Pingali Dan Grossman Orchestration and Atomicity by David Wilson Kitchin, B.S.C.S. Dissertation Presented to the Faculty of the Graduate School of The University of Texas at Austin in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy The University of Texas at Austin August 2013 This dissertation is dedicated to my mother and father, whose boundless love and support have made all of this possible. Acknowledgments First, I must express my gratitude to my best friend, Kristine Butler, without whose unwavering support I could never have completed this journey. I am also deeply grateful to my good friends Chris Lundberg and Mercedes Vaughn, who have given me a place to call home for the past three years, and whose wonderful companionship I have continually enjoyed. I am thankful every day for my loving, quirky, and brilliant family. I am grateful for my excellent advisor and mentor, Jay Misra, so much so that I am not sure how to put it into words. We have worked together for eight years, and our collaborations have always been productive and enjoyable. He has always treated me with respect, even when I have ignored his guidance or strained his patience. Jay is a great scholar, and I look forward to opportunities to work with him again in the future. My gratitude extends to all of the members of the Orc Research Group, past and present, who have each in their own way made the group a lively and interesting hub of great ideas and vigorous discussion.
    [Show full text]
  • Kotlin Coroutines for Android
    GDG Android Athens Meetup 2019/02/27 An introduction to Kotlin Coroutines for Android Antonis Lilis, Mobile Engineer The Problem How to prevent our applications from blocking ● Asynchronous or non-blocking programming is the new reality ○ Fluid client experience ○ Scalable server architecture Approaches ● Threads ○ hard to write and maintain ● Callbacks ○ series of nested callbacks which lead to incomprehensible code ● Futures, Promises,... ○ different programming mental model ● Reactive Extensions ○ everything is a stream, and it's observable ● Coroutines Coroutines ● Based on the concept of suspending functions ● The code is still structured as if we were writing synchronous code ● Are like light-weight threads ● Jetbrains engineers took the best ideas from other languages like Python, Go, C# and JS The term 'Coroutine' was coined by Melvin Conway in 1958 (known for Conway's Law) Kotlin Coroutines ● Kotlin provides Coroutine support at the language level ○ Actually it only adds one language keyword (suspend) ● Functionality is delegated to libraries ○ kotlinx.coroutines is a library developed by JetBrains ● Since Kotlin 1.3 Coroutines are no longer experimental ○ The major feature of this release Suspending Functions - Continuations Synchronous - Sequential Code Asynchronous - Concurrent Code The structure did not change much Coroutines are light-weight Suspending Functions (sequential code example) Suspending Functions ● Used inside coroutines ● They can call other ● Waits tasks like regular functions suspending functions to complete
    [Show full text]
  • Verifying Concurrent Programs by Controlling Alias Interference
    c Copyright 2014 Colin S. Gordon Verifying Concurrent Programs by Controlling Alias Interference Colin S. Gordon A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy University of Washington 2014 Reading Committee: Michael D. Ernst, Chair Dan Grossman, Chair Matthew Parkinson, Microsoft Research, Cambridge, UK Program Authorized to Offer Degree: UW Computer Science and Engineering University of Washington Abstract Verifying Concurrent Programs by Controlling Alias Interference Colin S. Gordon Co-Chairs of the Supervisory Committee: Professor Michael D. Ernst Computer Science and Engineering Associate Professor Dan Grossman Computer Science and Engineering This dissertation proposes a family of techniques for static verification of sequential and concurrent imperative programs by leveraging fine-grained characterizations of mutation. The key idea is that by attaching to each reference in a program (1) a restriction on mu- tations permitted using that reference, and (2) a characterization of possible interference through other aliases, a type system can reason about what properties are preserved by all mutations in a program. This thesis develops four variations on this idea: (1) We adapt reference immutability to support data-race-free concurrent programming. (2) We generalize reference immutability to rely-guarantee references, allowing two-state invariants to express usage restrictions be- tween read-only and arbitrary mutation. (3) We extend rely-guarantee references to prove invariants and functional correctness of lock-free concurrent data structures. (4) We evalu- ate rely-guarantee references' utility for existing Haskell programs. Together these variations show that reasoning about aliasing and reasoning about con- current (imperative) programs are the same fundamental challenge, and that by taking the right foundational approach to reasoning about sequential programs, the gap to reasoning about concurrent programs is significantly reduced.
    [Show full text]