473,625 Members | 3,306 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stackless python and microthreads

Hi,

I'm trying to use microthreads under stackless python, since they sound
like exactly what I am after, but I am having very little success.
I've got a fresh install of python 2.3.3 from python.org, then
downloaded the binary python2.3 release of stackless python from
www.stackless.com. This contained three files:

python23.dll, python23.lib, python23.exp

I searched for the original versions of these files, and copied:

stackless python23.dll over c:\winnt\system 32\python23.dll
stackless python23.lib over C:\Program Files\python2.3 \libs\python23. lib

Since I believe .exp files are associated with .lib files. I put the
..exp file in the same place as the lib. There was no existing file with
this name on my file system.

I then downloaded the microthreads package from
http://willware.net:8080/uthread.py

I then ran python, type 'import uthread' and immediately got the
following error.

---------------------------------------
Python 2.3.3 Stackless 3.0 040407 (#51, Apr 7 2004, 19:28:46) [MSC
v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
import uthread.py

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "uthread.py ", line 35, in ?
import continuation, sys, traceback, bisect, time, StringIO
ImportError: No module named continuation

Has anyone run into this before? Can someone tell me where to find this
continuation module?

Thanks,
Matt
Jul 18 '05 #1
28 4842
Continuations (which are the coolest things since programming was
invented) were forced out of Stackless Python around the end of version
2.0 for political reasons IIRC. Current Stackless doesn't have
continuation support at all, so any version of micro-threads written to
use continuations is just dead-on-arrival for the current version.
Stackless 1.0 and 2.0 were only for pre-2.3 releases of Python AFAIK.

I would imagine that *someone* has written a Tasklets-based
micro-threading implementation for the new Stackless (after all,
micro-threading is AFAIK *the* major use-case for Stackless (save for
those of us who like to play around with new modes of programming)) and
you'll just need to poke around for that rewrite.

In a former life I got paid to work on extending the continuation-based
micro-thread implementation. .. continuations are the most awesome toys
you can imagine... we will all mourn their passing in time...

Good luck,
Mike

Matt Leslie wrote:
....
I'm trying to use microthreads under stackless python, since they
sound like exactly what I am after,
....
python23.dll, python23.lib, python23.exp
....
I then downloaded the microthreads package from
http://willware.net:8080/uthread.py
....
ImportError: No module named continuation


....
_______________ _______________ _______________ ___
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
blog: http://zope.vex.net/~mcfletch/plumbing/
Jul 18 '05 #2
Mike C. Fletcher wrote:
continuations are the most awesome toys
you can imagine... we will all mourn their passing in time...


Will that be _before_, or _after_ we understand what they are? ;-)

-Peter
Jul 18 '05 #3
Quoth Peter Hansen <pe***@engcorp. com>:
| Mike C. Fletcher wrote:
|
| > continuations are the most awesome toys
| > you can imagine... we will all mourn their passing in time...
|
| Will that be _before_, or _after_ we understand what they are? ;-)

I gave them a try, and I mourn them with a touch of relief, I guess.
I'm the guy who won't bother to learn list comprehensions and generally
despises cool gimmicks, but continuations were more than just cool,
they were terribly powerful.

I hooked them into a graphics toolkit wrapper with an event dispatching
model where each window, network connection etc., ran in its own native
thread. No blocking, always ready to respond to a new message. When a
couple of these threads have to interact, they would queue messages back
and forth, and the programming paradigm can get awkward - a lot of state
can pile up as everyone's trying to keep track of their progress through
some kind of procedure.

Well, suppose you send your message and save the whole function state
somewhere, and return to the dispatcher. When the response comes back,
you pick up the function state and continue it, feeding the response in.

Now instead of a tedious kind of state machine, you're writing an plain,
ordinary function that sends messages to its peer and looks at the response,
as though that were all synchronous, and it's so much simpler. Yet the
execution underneath that isn't synchronous at all, because your computation
is suspended in between your send and the response. It really does return
every time it sends a message, it just starts up next time where it left
off.

Of course it's hairy, too. That's where the relief comes in. I'll never
be able to use continuations ... but then, I'll never have to deal with
anyone else's code that uses them.

Donn Cave, do**@drizzle.co m
Jul 18 '05 #4
"Mike C. Fletcher" <mc******@roger s.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
Continuations (which are the coolest things since programming was
invented) were forced out of Stackless Python around the end of version
2.0 for political reasons IIRC. Current Stackless doesn't have
continuation support at all, so any version of micro-threads written to
use continuations is just dead-on-arrival for the current version.
Stackless 1.0 and 2.0 were only for pre-2.3 releases of Python AFAIK.

In a former life I got paid to work on extending the continuation-based
micro-thread implementation. .. continuations are the most awesome toys
you can imagine... we will all mourn their passing in time...

Good luck,
Mike


Uhm ...

My experience with continuations (in Scheme) is limited, but I really
wonder if continuations have a place in a high level programming language.
I mean, continuations are basic building blocks: you can build on top
of them exception systems, generators, coroutines, microthreads, etc,
and it is an interesting learning experience to understand how this is
done.

However, to pass from continuations to something useful takes a
LONG way. Continuations are a too low level concept. A high level language
should already provide the right high level tools. I mean, the language
designer should implement generators, exception systems, microthreads, etc.
not the application programmer. When you have the high level concepts written
down by others, you don't need continuations.

So I guess now Stackless has microthreads built inside, and the application
programmer is not forced to write them on top of continations.

Speaking in general, generators and the current exception system are more
than enough for my typical needs in Python: which kind of applications do
you have in mind where you would like to have continuations? (a part from
microthreads and things like changing the language introducing new
control structures, etc, all stuff than should not be left to the
application programmer, IMHO).

Michele
Jul 18 '05 #5
> My experience with continuations (in Scheme) is limited, but I really
wonder if continuations have a place in a high level programming language.
I mean, continuations are basic building blocks: you can build on top
of them exception systems, generators, coroutines, microthreads, etc,
and it is an interesting learning experience to understand how this is
done. Yeah exactly, they are one reason which allows Scheme to be really
high-level.

They're pretty useful for web applications, too -- the difference to
above-mentioned examples would be that IMHO there is no adequate
alternative to them in current Python.
However, to pass from continuations to something useful takes a
LONG way. Continuations are a too low level concept. That probably depends on the point of view. I don't think it matters
much whether a specific feature is built-in into the language as such or
part of the/a standard library.
A high level language should already provide the right high level tools. I mean, the language designer should implement generators, exception systems, microthreads, etc. not the application programmer. When you have the high level concepts written
down by others, you don't need continuations. Would you have an idea on how a higher-level replacement for
continuations in web application development? I'm excited (and _not_
being any sarcastic or stuff, honestely!).
Speaking in general, generators and the current exception system are more
than enough for my typical needs in Python: which kind of applications do
you have in mind where you would like to have continuations? (a part from
microthreads and things like changing the language introducing new
control structures, etc, all stuff than should not be left to the
application programmer, IMHO).

Web application development involving Continuations (such as in Seaside,
the PST web server etc.).

Cheers,
Michael
Jul 18 '05 #6
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:
not the application programmer. When you have the high level concepts
written
down by others, you don't need continuations.

Would you have an idea on how a higher-level replacement for
continuations in web application development? I'm excited (and _not_
being any sarcastic or stuff, honestely!).


Co-routines.

Just
Jul 18 '05 #7
Just wrote:
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:

not the application programmer. When you have the high level concepts
written
down by others, you don't need continuations.


Would you have an idea on how a higher-level replacement for
continuatio ns in web application development? I'm excited (and _not_
being any sarcastic or stuff, honestely!).


Co-routines.

Would you care to elaborate? Can you store the state of a coroutine and
resume it multiple times?

Cheers,
Michael
Jul 18 '05 #8
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:
Just wrote:
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:
Would you have an idea on how a higher-level replacement for
continuatio ns in web application development? I'm excited (and _not_
being any sarcastic or stuff, honestely!).


Co-routines.

Would you care to elaborate? Can you store the state of a coroutine and
resume it multiple times?


You can resume a co-routine multiple times just like you can resume
generators mutliple times, but that's something completely different
from restarting a continuation multiple times.

When you mentioned continuations for web programming, I assumed you
meant their ability to turn flow control inside out (allowing to write
event-based networking code in a more natural way). Co-routines are a
much nicer abstraction for that than continuations.

Just
Jul 18 '05 #9
Just wrote:
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:

Just wrote:
In article <2g************ @uni-berlin.de>,
Michael Walter <cm@leetspeak.o rg> wrote:

Would you have an idea on how a higher-level replacement for
continuatio ns in web application development? I'm excited (and _not_
being any sarcastic or stuff, honestely!).

Co-routines.
Would you care to elaborate? Can you store the state of a coroutine and
resume it multiple times?

You can resume a co-routine multiple times just like you can resume
generators mutliple times, but that's something completely different
from restarting a continuation multiple times.

Well, I think you would want to resume it multiple times based on a
given state (essentially like resuming a stored continuation).
When you mentioned continuations for web programming, I assumed you
meant their ability to turn flow control inside out (allowing to write
event-based networking code in a more natural way). Co-routines are a
much nicer abstraction for that than continuations.

Would you have some links/papers for me in regard to web programming and
coroutines? Some quick googling didn't bring anything up (but maybe I'm
just too tired).

What I meant was using continuations for "linear" code flow, such as
mentioned in
http://www.ai.mit.edu/~gregs/ll1-dis.../msg02456.html,
described in http://www.double.co.nz/scheme/modal-web-server.html and
applied in Seaside, Borges, PLT Web Server etc.

Cheers,
Michael
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
3692
by: Bicho Verde | last post by:
I have now free time and money to do what I want :-) I have some basic skills in programming (C, Pascal, Macromedia Actionscript) but don't know exactly what to do in the world of programming. And also I don't know exactly why would I learn Python rather than C#, C++ or Perl. Basicaly I don't know where to start, if there is much to do or if it is has it seems and there is software to everything nowadays and so doesn't make sense to spend...
1
2316
by: srijit | last post by:
Hello Chris, Please refer an old message below. I unzipped python23.dll.zip and kept python23.dll in a local folder. I started Python from a dos box (Win XP machine) in the same local folder. I typed help(stackless) and got an error message, as shown below. D:\Python23\myfiles>python Python 2.3.3 (#51, Dec 18 2003, 20:22:39) on win32 Type "help", "copyright", "credits" or "license" for more information.
7
1680
by: Christian Tismer | last post by:
New Win32 binaries have been uploaded to the Stackless website. Some compatibility issues with certain constructors have been solved. Please let me know of any problems. more to come soon - cheers -- chris -- Christian Tismer :^) <mailto:tismer@stackless.com>
0
1336
by: Christian Tismer | last post by:
As already announced, the *********************************************** *** *** *** S t a c k l e s s S p r i n t *** *** *** *********************************************** has now a settled date: It will take place in Berlin, March 10-14 2004.
1
2269
by: Lorenzo Gatti | last post by:
Last weekend I tried to install Pygtk2 on Windows. I succeeded (maybe), but I discovered a likely bug. I have Windows 2000, Python 2.3.3 (with ActivePython installed after the normal version) and a recent Stackless 3.0 python23.dll. I think I've chosen correct and matching versions of GTK2 (Dropline distribution 2.2.4-2) and Pygtk2 (pygtk 2.2.0-1.win32-py2.3.exe). I installed both in the default locations (pygtk in site-packages, GTK2 in...
0
1201
by: Dmitry Borisov | last post by:
> This is true. For performance comparison reasons, and to make > Stackless "complete" in a way, I just developed real thread support > and measured context switch speed. Now it is not longer a claim, > but the truth (going to be Stackless 3.1): > > Stackless soft-switched channels are 10 times faster than > using real threads. > > Stackless tasklets are 10000 times smaller than threads on Windows. >
1
1938
by: Michael Hobbs | last post by:
Does anyone know of an existing package that provides microthreads, other than Stackless Python? I would like to be able to provide microthreads in my Candygram package, but I'm not interested in Stackless (for various reasons). In theory, it should be fairly straightforward to do preemptive microthreading using a combination of generators and a separate IO thread. The IO thread would poll for pending IO events and also periodically call...
3
2013
by: Richard Tew | last post by:
Hi, Stackless Python is now available for the recent release of Python 2.4.3 (final). You can either obtain the source code from the SVN repository or download the precompiled windows binaries. SVN: http://codespeak.net/svn/stackless/Python-2.4.3/dev Download: http://www.stackless.com/download
5
1858
by: Phillip B Oldham | last post by:
Will Python 3 be "stackless"? Or, rather, will it have any features similar to stackless' microthreads and channels?
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.