Team indes

Overall Objectives
Scientific Foundations
Application Domains
New Results
Contracts and Grants with Industry
Other Grants and Activities

Section: New Results

Models and semantics

Participants : Gérard Berry, Gérard Boudol, Gustavo Petri, Christian Queinnec, Manuel Serrano.

Semantics of concurrent programming

We are investigating the theory of multithreading. Multithreading is a form of concurrent programming where sequential programs (threads) run in parallel and communicate via a shared mutable store. Parallel execution is usually ruled according to some scheduling policy (in our work we consider preemptive, non-deterministic scheduling, that is the standard interleaving model), and controlled, from the threads, by means of synchronization constructs, like acquiring and releasing locks. It is well-known that this model is not correctly implemented in optimized execution platforms introducing some further parallelism in the computation, for instance in the accesses to the shared memory, like in weak memory models. Our work of last year on the write- buffering memory model has been published this year, see [12] . We have extended our approach to capture more relaxed memory models and, more generally, relaxed execution models where pieces of code can be executed in advance (or in parallel with the rest of the program), like with the write-buffers memory model where the updates to the memory are issued, and placed in buffers, while pursuing with the rest of the program. Such optimization mechanisms are known as speculative computation . We have proposed a formalization of a fully general notion of speculative computation, including branch prediction and value prediction. This is done in [17] for an expressive language (CoreML, or CoreScheme, that is the functional and imperative fragment of these languages, enriched with concurrent programming constructs) by means of Berry and Lévy's equivalence by permutation of computations. We have to define in particular a notion of valid speculation, since some speculative computation may be exploring the wrong branch in a conditional branching sub-program, the condition of which is not yet determined. We have shown that, for programs enjoying the property that their speculative execution does not create data-races (hence in particular for sequential programs), the speculative semantics correctly implements the standard interleaving semantics. We also propose in [18] a source programming language where a distinction is explicitly made between shared and private variables, and where we introduce a synchronization construct for temporarily having exclusive access to a shared variable. We show that, guided by a type and effect system guaranteeing that a private variable is indeed not shared, we can translate the (typable) programs of this language into programs that are correctly executed in the speculative semantics.

Regarding the latter core language for multithreaded programming, we have investigated another problem, namely the one of deadlocks. It is well-known that synchronization is needed to ensure exclusive access to shared data (like in updating a bank account, for instance), but that synchronization usually introduces deadlocks, a configuration where some threads cannot make any progress, being circularly blocked in waiting for a resource held by another thread. This is a kind of error that must be dealt with, and there are three techniques to do so: deadlock prevention (usually by means of static analysis or verification), deadlock detection and recovery (by means of a monitoring mechanism involving roll-back), and deadlock avoidance. Surprisingly enough, the last technique has not been explored at the programming language level. In [11] , we design, for a language similar to the one of [18] , a type and effect system where the locks that are anticipated to be acquired are recorded in the effect of a program. Then, guided by this analysis, we design a semantics where a lock is acquired only if no other lock that could be acquired in the future, that is, a lock in the effect of the program, is already held by another thread. We show that this provides, for typable programs, a deadlock-free semantics.

A multi-tier semantics for Hop

Hop is a multi-tier programming language where a single program specifies servers and clients behaviors altogether. Hop adheres to the standard web programming style where servers elaborate HTML pages containing JavaScript code. This JavaScript code responds locally to user's interactions but also (following the so-called Ajax style) requests services from remote servers. These services bring back new HTML fragments containing additional JavaScript code replacing or modifying the state of the client.

We have proposed a continuation-based denotational semantics for a sequential subset of Hop. Though restricted to a single server and a single client, this semantics takes into account the nature of the web where the server elaborates some JavaScript code to be run in the client's browser. This new client-code dynamically requests services from the server which, again, elaborates new JavaScript code to be run in the client's browser.

This semantics details the programming model advocated by Hop and provides a sound basis for future studies such as web continuations and concurrency. The semantics has been presented at the event dedicated to Mitch Wand that took place in Boston in August.


Logo Inria