• Home
  • Most Popular
  • Submit
  • About Us
  • Contact Us

Softpile

Free Downloads

Categories
  • Home
  • Most Popular
  • Communications
  • Desktop
  • Games & Entertainment
  • Graphic Apps
  • Network & Internet
  • Security & Privacy
  • System Utilities
Alternative to itextsharp 2022.11.10347
IronPDF offers an itextsharp alternative for HTML to PDF conversion with C# code examples, documentation, and ...
VShell Server for Linux and Mac 4.8
VShell is a versatile and secure file transfer server that supports multiple protocols and is compatible ...
PDF Studio PDF Editor for Linux 2022
PDF Studio is a cost-effective PDF editor that delivers full compatibility with the PDF Standard. It's ...
VQ Probe for Linux 1.5
VQ Probe is a comprehensive software tool that enables objective and subjective video quality analysis. The ...
Resilient Server 2.3
This Debian GNU/Linux (Buster) based software has a customized partitioning scheme that enhances robustness against filesystem ...
Valentina Studio for Linux 9.6
Valentina Studio is a cross-platform GUI manager for Mac, Windows, and Linux. It allows users to ...
VPN Lifeguard for Linux 1.0.58
The software monitors VPN connection and automatically terminates apps during connection loss, re-establishes the connection and ...
G_Viewer 0.84
G_Viewer is a Linux software that serves as both a file system and photo/image viewer. It ...
Checksome File Hash Tool for Linux 1.1
This software allows for the generation and verification of file hashes. It is a quick and ...
KeyWrangler Password Manager for Linux 1.2
A password management software that is secure, offline and extensible. It offers military-grade encryption to protect ...
Home Linux multitask Download

multitask

June 12, 2007
Multitask is a Python program that lets applications perform asynchronous I/O and cooperative multitasking using generators, aka coroutines.
Version 0.2.0
License MIT/X Consortium License
Platform Linux
Supported Languages English
Homepage o2s.csail.mit.edu
Developed by Chris Stawarz
Multitask is an excellent software that enables Python programs to use generators (also known as coroutines) for achieving cooperative multitasking and asynchronous I/O. When using multitask, applications are made up of a set of cooperating tasks that stop to allow a shared task manager to take over whenever a potentially blocking operation – like I/O on a socket, or getting data from a queue – is carried out. The task manager temporarily suspends the task, and during that period, other tasks can run before it restarts the blocked task when the operation is complete. This approach is perfect for applications requiring concurrency that would otherwise use select() and/or multiple threads.

Multitask is a free software distributed under the MIT license. As a simple example, imagine using Multitask to enable two unrelated tasks to run concurrently by adding a printer function:

def printer(message):
while True:
print message
yield

multitask.add(printer('hello'))
multitask.add(printer('goodbye'))
multitask.run()

This program prints out “hello” and “goodbye” in turn, pretty much as you would expect it to. For a more useful example, imagine that you want to implement a multitasking server capable of handling multiple concurrent client connections. You can easily achieve this by adding some child_task functions:

def listener(sock):
while True:
conn, address = (yield multitask.accept(sock))
multitask.add(client_handler(conn))

def client_handler(sock):
while True:
request = (yield multitask.recv(sock, 1024))
if not request:
break
response = handle_request(request)
yield multitask.send(sock, response)

multitask.add(listener(sock))
multitask.run()

With the functions and classes within the multitask module, tasks can stop for I/O operations on sockets and file descriptors, add/remove data to/from queues, or sleep for a set period. Tasks can also specify a timeout when yielding. If the specified operation is yet to complete after a given number of seconds, the task is restarted, and a Timeout exception is raised at the yielding point.

What makes Multitask really special is that tasks can yield other tasks, enabling composition of tasks and reusing multitasking code already in existence. In this case, a child task runs until it either completes or raises an exception, and its output or exception propagated to its parent. To illustrate:

def parent():
try:
print 'good child says: %s' % (yield child())
print 'bad child says: %s' % (yield child(bad=True)))
except Exception, e:
print 'caught exception: %s' % e

def child(bad=False):
if bad:
raise RuntimeError('oops!')
yield 'Hi, Mom!'

multitask.add(parent())
multitask.run()

In summary, Multitask requires Python 2.5 or later, and in its latest release, it has added functionality that enables child tasks to return values to their parent by raising StopIteration exceptions, introduced the get_default_task_manager() function for accessing the default TaskManager instance used by add() and run(), and added readline(), which is extremely useful for performing non-blocking reads from the stdout of a child process.
What's New

Version 0.2.0: N/A

Free Download 10K
374
  • Share on:

Most Popular

  1. Quicksilver Forums 1.4.2
    154
  2. Dvgrab 3.4
    102
  3. DynVPN 1.0
    89
  4. CherryTV 0.1
    81
  5. SlideMap 1.2.2
    80
  6. porm r2
    73
  7. Clewarecontrol 0.8
    72
  8. Java Games 1.0
    72
  9. Swiftfox 3.0b5pre-2
    71
  10. fuseftp 0.8
    71

Related Downloads

Spey
Spey is an intelligent software that acts as an SMTP proxy for ...
WMSMAIL
WMSMAIL is an email management software that allows users to monitor their ...
KDE4 Entries for RSS & XScreenSaver
KDE4 provides easy access to RSS and XScreenSaver services through shortcuts within ...
Host on Imageshack
This software provides a service menu feature for users to easily upload ...
Traditional Chinese Translation for eyeOS
eyeOS Internationalization allows users to translate and localize eyeOS desktop, apps and ...
DiamondList
This software is an open-source Ruby on Rails application developed for creating ...
PornView
PornView is a thumbnail based viewer of images and movies, allowing for ...
Rubicon Tracker
Rubicon Tracker is a web-based system for tracking issues and problems.
BenScript
BenScript is a no-cost interpreter for the BenScript programming language.
GNOME Video Arcade
GNOME Video Arcade is a user-friendly xmame front-end for GNOME. It simplifies ...
Copyright © 1999-2025 Softpile Free Downloads
  • Most Popular
  • Submit
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Terms of Use

Can we use your data to tailor ads for you?

Our partners will collect data and use cookies for ad personalization and measurement.

By choosing "I agree", closing this pop-up or clicking on any element on the page, you agree to the use of cookies to help us provide you with a better user experience.

Learn how Softpile and our partners collect and use data.

You can change your choice at any time in our privacy center.

Cookie Settings

Our website stores four types of cookies. At any time you can choose which cookies you accept and which you refuse. You can read more about what cookies are and what types of cookies we store in our Cookie Policy.

are necessary for technical reasons. Without them, this website may not function properly.

are necessary for specific functionality on the website. Without them, some features may be disabled.

allow us to analyse website use and to improve the visitor's experience.

allow us to personalise your experience and to send you relevant content and offers, on this website and other websites.