Code Monkey home page Code Monkey logo

vitamix's Introduction

vitamix: time virtualization for Go

vitamix is a source-to-source compiler, coupled with a runtime logic, for "virtualizing time" in Go programs. It is intended to aid in the testing of and experimentation with extremely time-sensitive "control" software, which is itself written in Go.

Problem statement

Control software (like robotic control or congestion control) is software that in one form or another listens to external events in real time and reacts with carefully-timed responses.

Control software is notoriously hard to get right, because even the time to compute a response (which depends on the specific implementation and the hardware) can and does affect the overall outcomes in a non-negligible manner.

In developing control software, one wants to be able to perform sandbox simulations, while meeting the following demands:

  • The computational time (i.e. the time it takes the software to compute a reaction to an event) is zero. Being able to do this is a way of decoupling the outcomes of the response logic (whose timing is of central importance) from the delays incurred by implementation and hardware peculiarities.

  • Execution outcomes are deterministically exactly reproducible, both in value and in timing. When writing tests for control software, the testing framework often needs to check whether responses occur at desired times. This is hard to achieve while using real time since even the outside temperature can affect the execution speed of your code.

  • Executions that are long-running in real time complete instantaneously in the sandbox. More often than not, we like to simulate a control algorithm for a long time (e.g. minutes) to verify that its behavior is stable over time. A long-running control program often sleeps most of the time, while waking up at sparse moments to respond to some external event. In a sandbox, we would really like to be able to execute such a long-running program without waiting through the times when the software is sleeping.

Beyond being able to skip over sleeping time and being able to remove the effect of your own code's run time, one can envision additional time-related needs like:

  • Simulate different and varying CPU speeds: This applies e.g. if one wants to test whether the control software behaves accurately in extreme situation when it is starved out of CPU resources by other running processes (e.g. a web server experiencing a denial-of-service attack).

In summary, we would like to be able to execute any Go program, while eliminating

vitamix accommodates precisely these needs: vitamix is a tool that allows one to execute

Concept

Principle of operation

vitamix consists of two parts:

  • Source-to-source transformer which rewrites the program source, and
  • Go package which is utilized by the rewritten source and acts as an additional runtime (additional to the Go runtime).

To install,

$ go get github.com/petar/vitamix

About

vitamix is authored and maintained by Petar Maymounkov.

vitamix's People

Contributors

petar avatar

Stargazers

 avatar Mahmoud Rusty Abdelkader avatar  avatar  avatar  avatar nimbosa avatar  avatar Isagani Mendoza avatar David Kirby avatar Andrew Hodges avatar sam boyer avatar Alex Sergeyev avatar Joseph Moore avatar Fouquet François avatar Tim avatar Andrei Dragomir avatar Frank Laub avatar Tomás Senart avatar Sam Ward avatar Taliesin Beynon avatar George Paley avatar Jim Fleming avatar Herbert Fischer avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.