{ "metadata": { "name": "", "signature": "sha256:1cb4d9289cab361b56db5e3f74a7ea5c8f83386bbcea038fa3d7ec7fbe44e7bf" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "back to [Index](index.ipynb)" ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "multitask-thoughts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2014-07-19" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "thoughts on multitasking" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Presentation on coroutines as a python OS mechanism\n", " * http://www.dabeaz.com/coroutines/Coroutines.pdf\n", " * no word of real time/timing\n", " * suggested next steps (search on http://pypi.python.org)\n", " * https://pypi.python.org/pypi/cogen/0.2.1\n", " * multitask\n", " * https://pypi.python.org/pypi/greenlet/0.4.2\n", " * eventlet\n", " * kamaelia" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* another survey\n", " * https://wiki.python.org/moin/Concurrency/\n", " * https://wiki.python.org/moin/ParallelProcessing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* cogen\n", " * has strange api, unpacks arrays for some reason." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* gevent\n", " * http://sdiehl.github.io/gevent-tutorial/\n", " * http://floss.zoomquiet.io/data/20120212130348/index.html\n", "* UNSORTED\n", " * https://wiki.python.org/moin/Concurrency/99Bottles\n", " * http://www.dabeaz.com/coroutines/\n", " * " ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "multiprocessing/multithreading" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* http://stackoverflow.com/questions/3044580/multiprocessing-vs-threading-python\n", "* serious work needs to be put into state sharing and safety" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "scrim" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* just make something that works" ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "the dream" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```python\n", "def ticker():\n", " while True:\n", " tick()\n", " sleep(.01)\n", "def controller():\n", " while True:\n", " control()\n", " sleep(.001)\n", " \n", "sched.add(ticker)\n", "sched.add(controller)\n", "sched.startAll()\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* easiest implementation\n", " * different notebooks, different process.\n", " * hard part: state sharing\n", " * http://mpi4py.scipy.org/docs/usrman/tutorial.html#point-to-point-communication" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* todo\n", " * measure latency/control frequency over lcm multiprocess" ] } ], "metadata": {} } ] }