72 research outputs found

    Implicit Invocation Meets Safe, Implicit Concurrency

    Get PDF
    Writing correct and efficient concurrent programs still remains a challenge. Explicit concurrency is difficult, error prone, and creates code which is hard to maintain and debug. This type of concurrency also treats modular program design and concurrency as separate goals, where modularity often suffers. To solve these problems, we are designing a new language that we call Panini. In this work, we focus on Panini\u27s asynchronous, typed events which reconcile the modularity goal promoted by the implicit invocation design style with the concurrency goal of exposing potential concurrency between the execution of subjects and observers. Since modularity is improved and concurrency is implicit in Panini, programs are easier to reason about and maintain. The language incorporates a static analysis to determine potential conflicts between handlers and a dynamic analysis which uses the conflict information to determine a safe order for handler invocation. This mechanism avoids races and deadlocks entirely, yielding programs with a guaranteed deterministic semantics. To evaluate our language design and implementation we show several examples of its usage as well as an empirical study of program performance. We found that not only is developing and understanding programs significantly easier compared to standard concurrent object-oriented programs, but also performance of Panini programs is comparable to their equivalent hand-tuned versions written using Java\u27s fork-join framework

    Open Effects

    Get PDF
    Open world assumption is an important design decision for modern object-oriented languages --- it allows extensibility in program design. Type-and-effect systems are also valuable for these languages, e.g. they can help reason about concurrent OO programs. Open world assumption, however, makes the design of a type-and-effect system challenging for an OO language. Main problem is with the computation of the effects of a dynamically dispatched method call, because all possible dynamic types are not known in advance. Previous research has proposed asking programmers for effect annotations that give an upper bound on the effects of a dynamically dispatched method call. This work describes an easier approach for programmers, albeit with some runtime overhead compared to previous work, which is based on the novel notion of open effects, effects that are optimistically assumed to satisfy the effect-based property of interest. We describe a sound type-and-effect system with open effects which has two parts: a static part that takes effects of dynamically dispatched calls with certain special references as an open effect; and a dynamic part that manages dynamic effects as these special references change and verifies that the optimistic assumptions about open effects hold. This system is implemented in the OpenJDK compiler and its utility is tested by applying it to verify non(interference) of concurrent tasks

    Formal foundations for hybrid effect analysis

    Get PDF
    Type-and-effect systems are a powerful tool for program construction and verification. Type-and-effect systems are useful because it can help reduce bugs in computer programs, enable compiler optimizations and also provide sort of program documentation. As software systems increasingly embrace dynamic features and complex modes of compilation, static effect systems have to reconcile over competing goals such as precision, soundness, modularity, and programmer productivity. In this thesis, we propose the idea of combining static and dynamic analysis for effect systems to improve precision and flexibility. We describe intensional effect polymorphism, a new foundation for effect systems that integrates static and dynamic effect checking. Our system allows the effect of polymorphic code to be intensionally inspected. It supports a highly precise notion of effect polymorphism through a lightweight notion of dynamic typing. When coupled with parametric polymorphism, the powerful system utilizes runtime information to enable precise effect reasoning, while at the same time retains strong type safety guarantees. The technical innovations of our design include a relational notion of effect checking, the use of bounded existential types to capture the subtle interactions between static typing and dynamic typing, and a differential alignment strategy to achieve efficiency in dynamic typing. We introduce the idea of first-class effects, where the computational effect of an expression can be programmatically reflected, passed around as values, and analyzed at run time. A broad range of designs “hard-coded in existing effect-guided analyses can be supported through intuitive programming abstractions. The core technical development is a type system with a couple of features. Our type system provides static guarantees to application-specific effect management properties through refinement types, promoting “correct-by-design effect-guided programming. Also, our type system computes not only the over-approximation of effects, but also their under-approximation. The duality unifies the common theme of permission vs. obligation in effect reasoning. Finally, we show the potential benefit of intensional effects by applying it to an event-driven system to obtain safe concurrency. The technical innovations of our system include a novel effect system to soundly approximate the dynamism introduced by runtime handlers registration, a static analysis to precompute the effects and a dynamic analysis that uses the precomputed effects to improve concurrency. Our design simplifies modular concurrency reasoning and avoids concurrency hazards

    Open Effects: Optimistic Effects for Dynamic Dispatch

    Get PDF
    The open world assumption in modern object-oriented languages makes the design of a type-and-effect system challenging. The main problem is with the computation of the effects of a dynamically dispatched method call, because all possible dynamic types are not known in advance. We show that the open world assumption and the need for a type-and-effect system can be reconciled. We propose open effects, an optimistic effect assumed to satisfy the effect-based property of interest. We describe a sound type-and-effect system with open effects which has two parts: a static part that takes effects of dynamically dispatched calls with certain special references as open effects; and a dynamic part that manages dynamic effects as these special references change and verifies that the optimistic assumptions about open effects hold. This system is implemented in the Open-JDK compiler, and its utility is tested by applying it to verify noninterference of concurrent tasks

    A Type-and-Effect System for Shared Memory, Concurrent Implicit Invocation Systems

    Get PDF
    Driven by the need to utilize multicore platforms, recent language designs aim to bring the concurrency advantages of events in distributed publish-subscribe systems to sequential OO programs that utilize the implicit invocation (II) design style. These proposals face two challenges. First, unlike the publish-subscribe paradigm where publisher and subscriber typically don\u27t share state, communicating via shared state is common in II programs. Second, type-and-effect systems that are generally designed for statically reasoning about a program\u27s execution are often too conservative to handle II that typically entails a virtual method invocation on zero or more dynamically registered handlers. To solve these problems, we present a novel hybrid type-and-effect system for exposing concurrency in programs that use II mechanisms. This type-and-effect system provides deadlock and data race freedom in such usage of II mechanisms. We have also implemented this type-and-effect system. An initial study shows its scalability benefits and acceptable costs

    A type-and-effect system for asynchronous, typed events

    Get PDF
    Implicit concurrency between handlers is important for event driven systems because it helps simultaneously promote modularity and scalability. Knowing the side-effect of the handlers is critical in these systems to avoid concurrency hazards such as data races. As event systems are dynamic because statically known and unknown handlers can register at almost any time during program execution, static effect analyses must reconcile over competing goals such as precision, soundness and modularity. We recently developed asynchronous, typed events, a system that can analyze the effects of the handlers at runtime. This mechanism utilizes runtime information to enable precise effect computation and greatly improves concurrency between handlers. In this paper, we present the formal underpinnings of asynchronous, typed events, and examine the concurrency safety properties it provides. The technical innovations of our system include a novel effect system to soundly approximate the dynamism introduced by runtime handlers registration, a static analysis to precompute the effects and a dynamic analysis that uses the precomputed effects to improve concurrency. Our design simplifies modular concurrency reasoning and avoids concurrency hazards

    Intensional Effect Polymorphism

    Get PDF
    Type-and-effect systems are a powerful tool for program construction and verification. We describe intensional effect polymorphism, a new foundation for effect systems that integrates static and dynamic effect checking. Our system allows the effect of polymorphic code to be intensionally inspected through a lightweight notion of dynamic typing. When coupled with parametric polymorphism, the powerful system utilizes runtime information to enable precise effect reasoning, while at the same time retains strong type safety guarantees. We build our ideas on top of an imperative core calculus with regions. The technical innovations of our design include a relational notion of effect checking, the use of bounded existential types to capture the subtle interactions between static typing and dynamic typing, and a differential alignment strategy to achieve efficiency in dynamic typing. We demonstrate the applications of intensional effect polymorphism in concurrent programming, security, graphical user interface access, and memoization

    First-class effect reflection for effect-guided programming

    Get PDF
    This paper introduces a novel type-and-effect calculus, first-class effects, where the computational effect of an expression can be programmatically reflected, passed around as values, and analyzed at run time. A broad range of designs “hard-coded” in existing effect-guided analyses — from thread scheduling, version-consistent software updating, to data zeroing — can be naturally supported through the programming abstractions. The core technical development is a type system with a number of features, including a hybrid type system that integrates static and dynamic effect analyses, a refinement type system to verify application-specific effect management properties, a double-bounded type system that computes both over-approximation of effects and their under-approximation. We introduce and establish a notion of soundness called trace consistency, defined in terms of how the effect and trace correspond. The property sheds foundational insight on “good” first-class effect programming

    Open Effects: Programmer-guided Effects for Open World Concurrent Programs

    Get PDF
    The open world assumption makes the design of a type-and-effect system challenging, especially in concurrent object-oriented languages. The main problem is in the computation of the effects of a dynamically dispatched method invocation, because all possible dynamic types of its receiver are not known statically. Previous work proposes effect annotations that provide a static upper bound on the effects of a dynamically dispatched method, conservative enough to cover the effects of all methods which could possibly be executed upon its invocation. For two dynamically dispatched methods, a typical type-and-effect system may disallow concurrent execution of their invocations because their conservatively specified static effects conflict. However, such a conflict may not actually happen at runtime, depending on the dynamic types of their receivers. This work proposes open effects, a sound trust-but-verify type-and-effect system, to better enable concurrent execution of dynamically dispatched method invocations. If a programmer annotates the receiver of a certain method invocation as open, then the type system trusts the programmer and assigns an open effect to the method. The open effect is supposed, optimistically, not to conflict with other effects. Such optimistic assumptions are verified statically, if possible, or at runtime otherwise. Open effects is complementary to previously proposed static and dynamic effect analyses and combines them such that the accuracy of static analysis could help decrease the overhead of the dynamic analysis. Performance evaluations of an implementation of open effects, on various benchmarks, show that: open effects incurs negligible annotation and runtime overheads such that code with open effects does almost as well as its manually tuned concurrent version
    • …
    corecore