473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

concurrency program design stackless python tasklet or python thread?

first here is my basic idea is every actor holds their own msg queue,
the process function will handle the message as soon as the dispatcher
object put the message in.

This idea naturally leads me to place every actor in a separate thread
waiting for msg

but the rumor has it, stackless python with tasklet and channel can do
much more better in concurrency program, so I dive my head into it.

but I found the tasklet is really a lined-up sequence , that means if
a tasklet blocked or do some time consuming calculation, the other
tasklets can not get the cpu slice

so we must design very carefully to avoid the big job for single task

I am just confused why the stackless python is said to be good at
concurrency program model or just I get a wrong idea to practice?
Nov 11 '08 #1
1 1877
In article <ma**************************************@python.o rg>,
davy zhang <da*******@gmail.comwrote:
>
first here is my basic idea is every actor holds their own msg queue,
the process function will handle the message as soon as the dispatcher
object put the message in.
Sounds like a standard design.
>This idea naturally leads me to place every actor in a separate thread
waiting for msg

but the rumor has it, stackless python with tasklet and channel can do
much more better in concurrency program, so I dive my head into it.

but I found the tasklet is really a lined-up sequence , that means if
a tasklet blocked or do some time consuming calculation, the other
tasklets can not get the cpu slice

so we must design very carefully to avoid the big job for single task

I am just confused why the stackless python is said to be good at
concurrency program model or just I get a wrong idea to practice?
Well, you have to be a bit careful, but Stackless is definitely one good
approach to handling your design. For example, EVE Online is an MMORPG
written in Python with a similar design. That said, I personally have
trouble wrapping my brain around Stackless, so I'd probably choose a
different technique.
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan
Nov 11 '08 #2

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

Similar topics

5
by: Christian Tismer | last post by:
Howdy, I made a little demo of Stackless Zope. It is just a quick hack to see how things can work. The example is a long-running Python method which "prints" lines to the browser. The key to...
0
by: Christian Tismer | last post by:
Hi friends, for the last two+ weeks, I was hacking on the internals of stackless, in order to make things cleaner, smaller, more natural and more complete. This patch is a quite essential...
9
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more...
2
by: Michael Hudson | last post by:
The PyPy development team has been busy working and we've now packaged our latest improvements, completed work and new experiments as version 0.9.0, our fourth public release. The highlights of...
14
by: fdu.xiaojf | last post by:
Hi, I have a program which will continue to run for several days. When it is running, I can't do anything except waiting because it takes over most of the CUP time. Is it possible that the...
3
by: archaegeo | last post by:
I am getting started in Python, and I have looked on both the stackless page and python.org and cannot find the answer to what I think is a simple problem. If I start the python command line or...
6
by: Justin T. | last post by:
Hi, I've been looking at stackless python a little bit, and it's awesome. My question is, why hasn't it been integrated into the upstream python tree? Does it cause problems with the current...
0
by: Linnorm | last post by:
I've written a port forwarding wrapper with paramiko for an app we use and it works fine except that it consumes way too much processor. (i.e. 25% +) I'm trying to write a stackless-based server...
0
by: davy zhang | last post by:
thank you very much for the advices! I asked myself many times, why not just use thread:D After some research I found thread has some fatal defects 1. thread number is limited by os, that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.