Programming with Futures, Lattices and Quiescence by Philipp Haller
This video was recorded at Scala Days Berlin 2016 follow us on Twitter @ScalaDays or visit our website for more information http://scaladays.org Abstract: Futures and promises in Scala are an integral part of asynchronous and concurrent code. Popular websites rely on futures for responsiveness in the presence of a large number of concurrent visitors. Furthermore, futures work well together with functional programming abstractions, thanks to the nature of future-based computations--single-assignment dataflow. However, futures also have important restrictions. For example, a future is completed with at most one result. Therefore, it is impossible to complete a future with a preliminary result and subsequently refine the result, for example, when more precise information becomes available. Finally, futures do not support resolving cyclic dependencies, instead resulting in deadlocks when such dependencies occur. In this talk, I report on an extension of Scala's futures with lattices and quiescence, inspired by related features in Haskell's LVish package and the LVars programming model. In this extended model the state of a future is an element of a lattice. Importantly, multiple updates of its corresponding "promise" are possible where updates correspond to join operations of the lattice. In addition, resolution of cyclic dependencies is supported through a mechanism based on detecting quiescence of the underlying execution context. The programming model is currently being exploited in the context of OPAL, a new Scala-based, concurrent static analysis framework developed at Technische Universität Darmstadt. In the last part of my talk I will report on experimental results (performance, code complexity) using lattice-based futures for several large-scale static analysis tasks (e.g., purity analysis, bug finding) with OPAL.