skip to main content
10.1145/1411204.1411205acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
invited-talk

Lazy and speculative execution in computer systems

Published:20 September 2008Publication History

ABSTRACT

The distinction between lazy and eager (or strict) evaluation has been studied in programming languages since Algol 60's call by name, as a way to avoid unnecessary work and to deal gracefully with infinite structures such as streams. It is deeply integrated in some languages, notably Haskell, and can be simulated in many languages by wrapping a lazy expression in a lambda. Less well studied is the role of laziness, and its opposite, speculation, in computer systems, both hardware and software. A wide range of techniques can be understood as applications of these two ideas. Laziness is the idea behind:

Redo logging for maintaining persistent state and replicated state machines: the log represents the current state, but it is evaluated only after a failure or to bring a replica online.

Copy-on-write schemes for maintaining multiple versions of a large, slowly changing state, usually in a database or file system.

Write buffers and writeback caches in memory and file systems, which are lazy about updating the main store.

Relaxed memory models and eventual consistency replication schemes (which require weakening the spec).

Clipping regions and expose events in graphics and window systems.

Carry-save adders, which defer propagating carries until a clean result is needed.

"Infinity" and "Not a number" results of floating point operations.

Futures (in programming) and out of order execution (in CPUs), which launch a computation but are lazy about consuming the result. Dataflow is a generalization.

"Formatting operators" in text editors, which apply properties such as "italic" to large regions of text by attaching a sequence of functions that compute the properties; the functions are not evaluated until the text needs to be displayed.

Stream processing in database queries, Unix pipes, etc., which conceptually applies operators to unbounded sequences of data, but rearranges the computation when possible to apply a sequence of operators to each data item in turn. Speculation is the idea behind:

Optimistic concurrency control in databases, and more recently in transactional memory

Prefetching in memory and file systems.

Branch prediction, and speculative execution in general in modern CPUs.

Data speculation, which works especially well when the data is cached but might be updated by a concurrent process. This is a form of optimistic concurrency control.

Exponential backoff schemes for scheduling a resource, most notably in LANs such as WiFi or classical Ethernet.

All forms of caching, which speculate that it's worth filling up some memory with data in the hope that it will be used again. In both cases it is usual to insist that the laziness or speculation is strictly a matter of scheduling that doesn't affect the result of a computation but only improves the performance. Sometimes, however, the spec is weakened, for example in eventual consistency. I will discuss many of these examples in detail and examine what they have in common, how they differ, and what factors govern the effectiveness of laziness and speculation in computer systems.

Skip Supplemental Material Section

Supplemental Material

Video

Index Terms

  1. Lazy and speculative execution in computer systems

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
          September 2008
          422 pages
          ISBN:9781595939197
          DOI:10.1145/1411204
          • cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 43, Issue 9
            ICFP '08
            September 2008
            399 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/1411203
            Issue’s Table of Contents

          Copyright © 2008 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 20 September 2008

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Author Tags

          Qualifiers

          • invited-talk

          Acceptance Rates

          Overall Acceptance Rate333of1,064submissions,31%

          Upcoming Conference

          ICFP '23

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!