Git Product home page Git Product logo

awaitexp's Introduction

Await/async experiments

This is a small set of experiments / explorations into the await/async feature described in PEP-0492 (https://www.python.org/dev/peps/pep-0492/) and implemented in Python 3.5.

Experiment 1 - Simplest scheduler.

The goal of experiment 1 is to have a essentially the simplest possible co-routine scheduler. This is in juxtaposition to the relatively complex schedulers found in the standard asyncio module.

Experiement 2 - Simple scheduler w/ sleep function

The goal of experiment 2 is to add an awaitable sleep co-routine function to our scheduler. This adds a reasonable amount of complexity to the scheduler, although the sleep function itself is rather simple. Whether or not this sleep aspect of the scheduler will be easily composable with other events in the future will be interesting.

Experiment 3 - Enable adding new co-routines

Currently only the co-routines specified at the start can be scheduled. The goal of this experiment is to allow new co-routines to be added after the scheudler has started running.

Experiment 4 - Interacting with a thread pool

Sometimes there are compute (or IO) task that would be better to perform in the background, not on the main thread. This experiment shows an example of the ThreadPoolExecuter interacting with scheduled co-routines to achieve backgrounded computation. This technique probably won't be a good basis in the long run as it will not be possible to wait on an IO selector and a thread Queue at the same time.

Experiment 5 - Interact with selectable file descriptors

A typical use of co-routines is to interact with asynchronous I/O. The goal of this experiment is to have the scheduler interact with Python's selectors module to provide a basic async I/O model.

Experiment 6 - Interact with thread pool and selectable file descriptors

The goal of this experiment is to effectively merge the features in experiments 4 and 5. This will use the standard self-pipe (actually a self-socket) trick to notify the select method of background completion.

awaitexp's People

Contributors

bennoleslie avatar

Watchers

 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.